how to compute the complex Fourier series expansion of half-wave rectified signal. and plot its phase and amplitude spectrum?

Answers (4)

My impression is that this is homework. We give hints for homework, not complete code. (You must write the code. We will help you to get your code to run if you have problems with it.)
It is straightforward to compute the Fourier transform symbolically. You need to remember also to allow for the part of the signal that is zero in the time range that you are computing it.
You already discovered Hi how do i plot a halfwave rectifier signal in matlab? i tried the coding below and only got the fullwave (since you posted a Comment to it to request thatI look at this Question), all you then need to do is to read the documentation for fft and use that with the signal I provided in that Answer.

9 Comments

its actually not a homework, i am trying to check the amplitude and the phase, for my own study, but i never used matlab before and idont even know how to code, i know the coefficants of the series and the idea of phasing, but i dont know how to use this app thats why i am asking for some help, please help me and thanks
and the thing is that i dont even have the function of the half wave rectified so i can use fft
In that instance, use the second part of my Answer and plot the fft of the half-wave rectified signal.
The table that you posted appears to require a context that is not provided.
i am trying to
f=50;
t=linspace(0,30,500);
x=sin(2*pi*f*t);
rect_sig = sig > 0;
y = fft(x);
f = (0:length(y)-1)*50/length(y);
plot(f,abs(y))
title('Magnitude')
subplot(221)
stem(t,abs(sig))
i cant get the amplitude spectra
it should be straight lines, any help?
i fixed it a little bit
l=linspace(0,10,100);
sig=sin(2*pi*50*l);
subplot(211)
plot(sig);
grid
% u=1:9;
% t=(1:)
for t=1:100
if sin(2*pi*50*l(t))<=0
sig(t)=0;
else
sig(t) = sin(2*pi*50*l(t));
end
end
subplot(212)
plot(sig);
grid
stem(l,abs(sig),'b')
still cant get straight lines
whats the issue?
Try this slightly modified version of your code:
f=50;
t=linspace(0,30,500);
Fs = 1/(t(2)-t(1));
Fn = Fs/2;
sig=sin(2*pi*f*t);
rect_sig = sig.*(sig > 0); % Half-Wave Rectification
y = fft(rect_sig)/numel(sig);
f = linspace(0, 1, fix(numel(sig)/2)+1)*Fn; % Frequency Vector
idx = 1:numel(f); % Index Vector
% f = (0:length(y)-1)*50/length(y);
figure
subplot(2,1,1)
semilogy(f,abs(y(idx))*2)
title('Magnitude')
grid
subplot(2,1,2)
plot(f,unwrap(angle(y(idx))))
title('Phase')
grid
figure
% subplot(221)
stem(t,rect_sig)
.
how can i change the magnitude to amplitude?
i know i made trouble for you but i reaLLY APPRECIATE IT
how can i make the amplitude and phase look like this? as straight lines
or is it just like this when n= a constant number?
To get the amplitude (amplitude = magnitude) spectrum such as in the plot image, use the fftshift function, then plot using a symmetric frequency vector, for example:
sy = fftshift(y);
sf = linspace(-10,10, numel(sy));
then:
figure
stem(sf, sy)
or something similar.

Sign in to comment.

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Asked:

WJ
on 12 Aug 2020

Answered:

on 19 Jun 2021

Community Treasure Hunt

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

Start Hunting!