TAGGED: fdtd, precision, s-parameters
-
-
June 24, 2021 at 7:44 pmdjihad-amina.djemmahSubscriber
I am using grating S-parameters to calculate the S-parameters, but I don't know how to get the value of the S-parameters in double precision, because when I retrievethe values, I only have 6 digits after the decimal point (see attachment).
Could you please help me to have more digits after the decimal point (double precision).
June 25, 2021 at 4:51 pmGreg BaethgeAnsys Employee
Thank you for posting your question on the forum. There's a couple of different ways to change the precision used to display values. You can do it "globally" using format:
format long;
This will set the script interpreter to 16 digits of precision.
Alternatively, you can also control the number of digits when converting numerical values to string with num2str, for example:
?num2str(pi, "%.35f");
3.14159265358979311599796346854418516
June 26, 2021 at 10:33 amdjihad-amina.djemmahSubscriberHello Thank you for your answer
The problem I have, I don't know where I have to write "long format;", I am not very familiar with lumerical sript.
In attachment, you will find a screenshot of my simulation, could you tell me where exactly I have to write "long format" to get the values of the S parameters with 16 digits of precision.
I am waiting for your answer Thank you in advance
June 28, 2021 at 9:28 amdjihad-amina.djemmahSubscriberHello I have tried several commands, but none of them work (see attachment).
What I need exactly is to get "S-parameters" data with a precision of 16 digits, if it is possible could you give me the syntax I have to write in the prompt script.
I have already read all the Lumerical documentation, but I still can't figure out what I need to write to get the data with a double presicion.
Looking forward to your reply.
Thank you in advance
June 28, 2021 at 12:26 pmdjihad-amina.djemmahSubscriberI just realized that I attached the wrong file, you can find the right one here.
The commands:
nf=length(f);
for(i=1: nf){
str= num2str(f(i))+", "+num2str(T(i));
write("tetfile.txt",str);
}
Works well with T and R monitors but not with S, with S I got this error :"Error: prompt line 2: in expression A(i,...), A must be a matrix".
Could you please help me to solve this problem.
Thank you in advance.
June 28, 2021 at 12:47 pmGreg BaethgeAnsys Employee
The issue is, S is a dataset, you can only use num2str on a scalar value or a 2d matrix. You can use the "." operator to access the values, for example:
f = S.f;
S21 = S.S21_Gn;
Then the loop should work.
June 28, 2021 at 3:54 pmGreg BaethgeAnsys EmployeeI just realized I forgot to answer one of the questions. "format long" should be placed at the start of the script, that way you are sure it was run before you start writing data.
June 29, 2021 at 7:32 amdjihad-amina.djemmahSubscriberHello Thank you for your your help, with your explanations I managed to do it.
June 29, 2021 at 11:39 amGreg BaethgeAnsys EmployeeYou're most welcome, :)
Viewing 8 reply threads- The topic ‘Grating S parameters’ is closed to new replies.
Ansys Innovation SpaceTrending discussionsTop Contributors-
891
-
442
-
373
-
225
-
201
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.
-
The Ansys Learning Forum is a public forum. You are prohibited from providing (i) information that is confidential to You, your employer, or any third party, (ii) Personal Data or individually identifiable health information, (iii) any information that is U.S. Government Classified, Controlled Unclassified Information, International Traffic in Arms Regulators (ITAR) or Export Administration Regulators (EAR) controlled or otherwise have been determined by the United States Government or by a foreign government to require protection against unauthorized disclosure for reasons of national security, or (iv) topics or information restricted by the People's Republic of China data protection and privacy laws.