Unable to use the variable from workspace which is sent to the MATLAB workspace using 'To workspace' block of the Simulink.

2 Ansichten (letzte 30 Tage)
Taimoor Khan Mehmand am 7 Mär. 2023
Kommentiert: Fangjun Jiang am 7 Mär. 2023
I have a signal of my Simulink model which I have named as 'Fs'. I am using 'To workspace' block of the Simulink to store the signal in MATLAB workspace. The variable name is 'Fs' and the save format is 'Structure With Time' . The signal 'Fs' is not a vector, it is a 1 dimensional signal (basically it is a frequency signal of a Power Transmission System i..e. 50Hz ). I want to apply Empirical Mode Decomposition on this frequency signal. When I run the code it gives me the following error.. Error using load
Unable to read file 'IEEE_14_Bus_System_SM_FFR.mat'. No such file or directory.
Following is my code...
freq_signal = Fs.signals.values;
disp(freq_signal)
% Step 1: Find extrema and obtain upper and lower envelopes
sampling_rate = 1000; % Hz
[~, upper_env] = envelope(freq_signal,round(sampling_rate/20),'peak');
[~, lower_env] = envelope(freq_signal,round(sampling_rate/20),'trough');
% Step 2: Compute the mean envelope
mean_env = (upper_env + lower_env)/2;
% Step 3: Initialize k and perform empirical mode decomposition
k = 1;
imf = [];
residual = freq_signal;
while true
% Step 3a: Extract the kth IMF
[imf_k,~,residual_k] = emd(residual-mean_env,'Display',0,'MaxNumIMF',1);
imf = [imf imf_k];
disp(imf)
% Step 3b: Check if the kth IMF is the last IMF
if size(residual_k,1) < 2
imf = [imf residual_k];
break;
end
% Step 3c: Prepare for next iteration
k = k + 1;
residual = residual_k;
end
% Step 4: Compute the residuals and extract additional IMFs
residual = freq_signal - imf;
imf2 = [];
while true
% Step 4a: Extract the next IMF
[imf_k,~,residual_k] = emd(residual-mean_env,'Display',0,'MaxNumIMF',1);
imf2 = [imf2 imf_k];
% Step 4b: Check if the kth IMF is the last IMF
if size(residual_k,1) < 2
imf2 = [imf2 residual_k];
break;
end
% Step 4c: Prepare for next iteration
residual = residual_k;
end
% Step 5: Compute the derivatives of the IMFs
for i = 1:size(imf,2)
end
for i = 1:size(imf2,2)
end
disp(deriv_imf2)
Can any staff members assist in this regard???
0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Fangjun Jiang am 7 Mär. 2023
"Unable to read file 'IEEE_14_Bus_System_SM_FFR.mat'. No such file or directory."
Make sure you have that .mat file. Use Command Line to load it, check 'Fs' is there and have the right data.
5 Kommentare4 ältere Kommentare anzeigen4 ältere Kommentare ausblenden
Fangjun Jiang am 7 Mär. 2023
@Paul, good point!

Melden Sie sich an, um zu kommentieren.

Kategorien

Find more on Hilbert and Walsh-Hadamard Transforms in Help Center and File Exchange

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by