From: Issopui on
Hello there.
I have just implemented a 3 phase PWM DC/AC converter in Simulink using IGBTD with a "RL" load and I have to write and algorithm to show the Frequency domain. I don't really know how to do it.I have just try to write something down onmy M-file which is:
% tstep = t(2)- t(1);
% fsample = 1/tstep;
% time1 = t1;
% time2 = t2;

t = 0:1/50:50-1/50;
x = 0.8*500*sin (2*pi*t);
y = fft(x);
m = abs(y);
f = (0:length(y)-1)*50/length(y);
plot(f,20*log10(m)),
% stem(x,y,'.'),
ylabel('Abs. Magnitude'),
I think I may need to use the commented line to be able to visualize any load voltage like line to line or line to neutral
Hope u guys can help me
Many Thanks
From: Greg Heath on
On Jun 19, 7:37 am, "Issopui " <manka_...(a)yahoo.com> wrote:
> Hello there.
> I have just implemented a 3 phase PWM DC/AC converter in Simulink using IGBTD with a "RL" load and I have to write and algorithm to show the Frequency domain. I don't really know how to do it.I have just try to write something down onmy M-file which is:
> % tstep = t(2)- t(1);
> % fsample = 1/tstep;
> % time1 = t1;
> % time2 = t2;
>
> t = 0:1/50:50-1/50;
> x = 0.8*500*sin (2*pi*t);
> y = fft(x);
> m = abs(y);
> f = (0:length(y)-1)*50/length(y);
> plot(f,20*log10(m)),
> % stem(x,y,'.'),
> ylabel('Abs. Magnitude'),

Fs = 50
N = length(x)
df = Fs/N
f = df*(0:N-1);
fb = f-df*(N/2); % Zero centered frequency interval

PSD = abs(y).^2/N; Power Spectral density
PSDdb = 10*log10(PSD);
plot(fb, fftshift(PSDdB))
ylabel('Power Spectral Density (dB)')

> I think I may need to use the commented line to be able to
> visualize any load voltage like line to line or line to neutral

Too many points to use "stem" (personal opinion).

> Hope u guys can help me

Have a specific question?

Hope this helps.

Greg
From: Issopui on

> Fs = 50
> N = length(x)
> df = Fs/N
> f = df*(0:N-1);
> fb = f-df*(N/2); % Zero centered frequency interval
>
> PSD = abs(y).^2/N; Power Spectral density
> PSDdb = 10*log10(PSD);
> plot(fb, fftshift(PSDdB))
> ylabel('Power Spectral Density (dB)')
>
> > I think I may need to use the commented line to be able to
> > visualize any load voltage like line to line or line to neutral
>
> Too many points to use "stem" (personal opinion).
>
> > Hope u guys can help me
>
> Have a specific question?
Thanks for ur help.
I have another question how can I introduce it as a function so that when I called it on Matlab workspace I can see the plot?
I mean something like this one from one of the function I got in the lab.
myfft(voltage1.time,voltage1.signals.values,0,0.02,0.1)
When I type the above line on the matlad i got the plot is there any way I can do the same for the program u help me with?
Many Thanks

> Hope this helps.
>
> Greg
From: Greg Heath on
On Jun 21, 4:30 pm, "Issopui " <manka_...(a)yahoo.com> wrote:
> > Fs = 50
> > N = length(x)
> > df = Fs/N
> > f = df*(0:N-1);
> > fb = f-df*(N/2);    % Zero centered frequency interval
>
> > PSD = abs(y).^2/N;   Power Spectral density
> > PSDdb = 10*log10(PSD);
> > plot(fb, fftshift(PSDdB))
> > ylabel('Power Spectral Density (dB)')
>
> > > I think I may need to use the commented line to be able to
> > > visualize any load voltage like line to line or line to neutral
>
> > Too many points to use "stem" (personal opinion).
>
> > > Hope u guys can help me
>
> > Have a specific question?
>
> Thanks for ur help.
> I have another question how can I introduce it as a function so that when I called it on Matlab workspace I can see the plot?
> I mean something like this one from one of the function I got in the lab.
> myfft(voltage1.time,voltage1.signals.values,0,0.02,0.1)
> When I type the above line on the matlad i got the plot is there any way I can do the same for the program u help me with?

Yes. It is straightforward.

Post your code if you have debugging trouble.

Hope this helps.

Greg
From: Issopui on
Hi Greg,
Many thanks for ur help it has worked as required.I would like to show u some file I have got I don't know if I can send it by ur e-mail as I think I can send a file here and in case u know how to do it here (sending a file) just let me know and i will send it to u.
Many thanks.