simos421 / CST-MATLAB-API

CST-MATLAB-API
GNU General Public License v3.0
212 stars 60 forks source link

how to export data by using exportSparameters function? #10

Closed Sarvesh178 closed 2 years ago

Sarvesh178 commented 2 years ago

i want plots for for s11,s22,s21,s12 ...how to extract data and plot this data

simos421 commented 2 years ago

Hi, please check MicrostripExample.m and you will find everything you need there step by step. I used this sequence to extract and plot the S11:

CstExportSparametersTXT(mws, exportpath) [Frequency, Sparametter] = CstLoadSparametterTXT(filenameTXT); plot(Frequency,Sparametter,'-'); grid on; legend('S11 (dB)') title('patch antenna at 2.45GHz') xlabel('Frequency (GHz)')

For the s21 you will need any of my two port examples. For instance in TwoDipolesExample.m i used this for the S11 & S21:

CstExportTouchstone(mws,exportpath, format) data = read(rfdata.data,'NameofyourFile.s2p'); freq = data.Freq; s_params = extract(data,'S_PARAMETERS',50); spar = squeeze(s_params(1,:,:)); spar = spar'; sdb = 20*log10(sqrt(real(spar).^2 + imag(spar).^2)); S11 = sdb(:,1); S21 = sdb(:,2); figure subplot(2,1,1) plot(freq,S11); grid on; title('S11') subplot(2,1,2) plot(freq,S21); grid on; title('S21')

Thanks Simos

On Thu, 12 May 2022 at 20:14, Sarvesh178 @.***> wrote:

i want plots for for s11,s22,s21,s12 ...how to extract data and plot this data

— Reply to this email directly, view it on GitHub https://github.com/simos421/CST-MATLAB-API/issues/10, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJAISOI4FIUU7MFM76NZAILVJU37FANCNFSM5VY5UYFQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Sarvesh178 commented 2 years ago

Is there any way to export unit cell graph and image directly from cst to MATLAB...only the image ...in view option we do have export image option...but how to control from matlab by commands

simos421 commented 2 years ago

Not sure what you mean, I suggest checking MetamaterialUnitCellExample.m. Most probably you can do almost anything using matlab but you need to see all my examples to have a better view of the basic functions and their usability. If you want to do something very specific that I haven't done yet, it's very easy to do it yourself by following these steps:

1) first design what you want in CST, without using matlab 2) then, if you open the history log of CST you will see that it records everything you did in visual basic script 3) Now you need to interface this script with matlab. So open one of my functions (e.g. anything in the home folder of the api) and see how I translate tha visual basic script into a matlab function. I use the invoke function in matlab to do the visual basic to matlab translation. It might look intimidating but it is very easy. Mostly just copy-paste

Thanks Simos

On Fri, 13 May 2022 at 04:09, Sarvesh178 @.***> wrote:

Is there any way to export unit cell graph and image directly from cat to MATLAB

— Reply to this email directly, view it on GitHub https://github.com/simos421/CST-MATLAB-API/issues/10#issuecomment-1125561014, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJAISOMPFQXEHNRW4UNZF43VJWTTNANCNFSM5VY5UYFQ . You are receiving this because you commented.Message ID: @.***>

Sarvesh178 commented 2 years ago

Thank you sir for your response...i followed ur steps 1.Created unit cell 2.Checked history list wrote the code related to it

  1. It's working..but when I tried to export image of unit cell...from view--------Export image in cst...it is getting exported and saved as image into my folder 4.but in history list export image command is not there to write function into my matlab code
Sarvesh178 commented 2 years ago

I have to create Function code in matlab that can export 3D view of my design (from Cst )to matlab

All these figures have to save in folder...

Sarvesh178 commented 2 years ago

Sir plz any replies

simos421 commented 2 years ago

If it doesn't appear in the history it might not be possible to do it. Maybe do that manually

On Sun, 15 May 2022 at 07:45, Sarvesh178 @.***> wrote:

Sir plz any replies

— Reply to this email directly, view it on GitHub https://github.com/simos421/CST-MATLAB-API/issues/10#issuecomment-1126858782, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJAISOJUEFWBXGYRSXQF33TVKB6OXANCNFSM5VY5UYFQ . You are receiving this because you commented.Message ID: @.***>

Sarvesh178 commented 2 years ago

Sir i found this link .... somehow useful ..and facing difficulty to incorporate into my code ....because i have adapted ur way style of writing the code by seeing ur examples.. any suggestions guidance would be really helpful regarding this.. https://in.mathworks.com/matlabcentral/fileexchange/72228-tcstinterface-cst-studio-suite-to-matlab-interface/?s_tid=LandingPageTabfx ---- plz have a look once [Exporting geomertical moded from CST as an image]

simos421 commented 2 years ago

Hi, If it doesn't appear in the history it might not be possible to do it. Maybe do that manually

On Sat, 14 May 2022 at 08:02, Sarvesh178 @.***> wrote:

I have to create Function code in matlab that can export 3D view of my design (from Cst )to matlab

All these figures have to save in folder...

— Reply to this email directly, view it on GitHub https://github.com/simos421/CST-MATLAB-API/issues/10#issuecomment-1126641994, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJAISOKOAW3PMQY5BSNK3LLVJ4XVHANCNFSM5VY5UYFQ . You are receiving this because you commented.Message ID: @.***>