Hi,I have a simulink file and have exported the scopedata into workspace.
Now the output of the scope is a square. The objective is to plot the fundamental wave.
What I have done a) Export scope data b) fft using the following code C) The fundamental is 50hz . Either to look up the element where 50hz occur from array or find the maximum. However the maximum method doesn't produce accurate results.
Any suggestions to the code?. Also interested to know if there a direct method to achieve this from simulink itself
NFFT = 2^nextpow2(L);
Y = fft(data,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
plot(f,2*abs(Y(1:NFFT/2+1)));axis([-.01 750 0 450]);grid on;
title('Single-Sided Amplitude Spectrum of Line to Line Voltage')