-
-
April 4, 2024 at 3:06 amjeong hee yunSubscriberI am writing code to automate S-parameter matrix sweep simulation using Port1 and Port2.ÂThe code written so far is as follows.Âdeletesweep("s-parameter sweep");
addsweep(3);
setsweep("s-parameter sweep", "name", "S sweep");
setsweep("s-parameter sweep", "Excite all ports", 0);
runsweep("S sweep");
S_parameters = getsweepresult("S sweep","S parameters");
visualize(S_parameters);ÂÂHowever, in the visualize result window, I want to select the unit of 'scalar opration' of 'S11, S12, S21, S22 result values' as 'abs^2' instead of 'Re' and save the data as a text file, but I don't know how -
April 4, 2024 at 5:46 pmAmrita PatiAnsys Employee
Hi Jeong Hee,
I think you can not specify the operation in visualize using script. Either you have to create a new dataset with the squared values, and then visualize that dataset. Or you can simply plot the square values using the plot script command and then use write to save the values into a text file. I wrote a sample script to plot data and write them into text file, that might be useful for your case:
S_para= getsweepresult("S-parameters","S parameters");
lambda = S_para.lambda;
S_11_2 = abs(S_para.S11)^2; #_2 after S_11 is just to indicate that it's squared
S_12_2 = abs(S_para.S12)^2;
S_21_2 = abs(S_para.S21)^2;
S_22_2 = abs(S_para.S22)^2;
plot(lambda,S_11_2);
holdon;
plot(lambda,S_12_2);
plot(lambda,S_21_2);
plot(lambda,S_22_2);
holdoff;
write("S_param.txt","S11_2: "+ num2str(S_11_2));
write("S_param.txt","S12_2: "+ num2str(S_12_2));
write("S_param.txt","S21_2: "+ num2str(S_21_2));
write("S_param.txt","S22_2: "+ num2str(S_22_2));Â
Here's a screenshot of the figure window and the created text file:
Â
Let me know if you have any questions.
Â
Regards,
AmritaÂ
-
April 8, 2024 at 6:00 amjeong hee yunSubscriber
Sorry for the late reply. It really helped me a lot. Thank you for your kind reply!
-
-
Viewing 1 reply thread
- You must be logged in to reply to this topic.
Ansys Innovation Space
Trending discussions
Top Contributors
-
461
-
230
-
200
-
183
-
162
Top Rated Tags
© 2024 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.