how to get the sampling frequency from powergui as variable in workspace?

1 次查看(过去 30 天)
clc;
tout = [0;3.46876101232481e-08;2.08125660739489e-07;1.07531591382069e-06;5.41126717922670e-06;2.70910235062568e-05;5.00000000000000e-05;0.000100000000000000;0.000150000000000000;0.000200000000000000;0.000250000000000000;0.000300000000000000;0.000350000000000000;0.000400000000000000;0.000450000000000000;0.000500000000000000;0.000550000000000000;0.000600000000000000;0.000650000000000000;0.000700000000000000;0.000750000000000000;0.000800000000000000;0.000850000000000000;0.000900000000000000;0.000950000000000000;0.00100000000000000;0.00105000000000000;0.00110000000000000;0.00115000000000000;0.00120000000000000;0.00125000000000000;0.00130000000000000;0.00135000000000000;0.00140000000000000;0.00145000000000000;0.00150000000000000;0.00155000000000000;0.00160000000000000;0.00165000000000000;0.00170000000000000;0.00175000000000000;0.00180000000000000;0.00185000000000000;0.00190000000000000;0.00195000000000000;0.00200000000000000;0.00205000000000000;0.00210000000000000;0.00215000000000000;0.00220000000000000;0.00225000000000000;0.00230000000000000;0.00235000000000000;0.00240000000000000;0.00245000000000000;0.00250000000000000;0.00255000000000000;0.00260000000000000;0.00265000000000000;0.00270000000000000;0.00275000000000000;0.00280000000000000;0.00285000000000000;0.00290000000000000;0.00295000000000000;0.00300000000000000;0.00305000000000000;0.00310000000000000;0.00315000000000000;0.00320000000000000;0.00325000000000000;0.00330000000000000;0.00335000000000000;0.00340000000000000;0.00345000000000000;0.00350000000000000;0.00355000000000000;0.00360000000000000;0.00365000000000000;0.00370000000000000;0.00375000000000000;0.00380000000000000;0.00385000000000000;0.00390000000000000;0.00395000000000000;0.00400000000000000;0.00405000000000000;0.00410000000000000;0.00415000000000000;0.00420000000000000;0.00425000000000000;0.00430000000000000;0.00435000000000000;0.00440000000000000;0.00445000000000000;0.00450000000000000;0.00455000000000000;0.00460000000000000;0.00465000000000000;0.00470000000000000];
%tout1 = [0, 0.2, 0.3, 1, 2, 3, 4, 5];
NS1 = size(tout); % to find the number of samples
tout1=tout;
n=NS1(1,1);
%tout: a vector of number. The below removes numbers that are not multiple of 0.00005
tol = 1e-10; %abritrary tolerance below which numbers are considered equal
tout(abs(mod(tout, 0.00005)) > tol) = [];
tout = unique(tout);
for the above code 0.00005 is the sampling frequency from the Powergui of the model for which the above code is used to generate .data file for COMTRADE code.
The thing is the sampling frequency can be changed as per the requirement of the user. But if that happens 0.00005 doesnt remain valid for the above code.
is there any way so that the sampling frequency from the Powergui can be directly be directed in the code? like creating a variable in workspace and using that variable in the code?
If its possible then anyone can help me with that please?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simscape Electrical 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by