Question

Please Solve this Question anyway either by using MATLAB or any other way ..... QUESTION : Generate a square wave with p...

Please Solve this Question anyway either by using MATLAB or any other way .....

QUESTION :

Generate a square wave with peak as last 2 digits of your roll number.

Find the overshoot value for this square wave.

How many harmonics are required to generate this square wave with 9% overshoot.

Find the overshoot when 101 harmonics are used.

Find the overshoot when 401 harmonics are used.

Exploit the effect of odd harmonics in generating a square wave.

Draw necessary conclusions about Gibbs phenomenon and its effects on Fourier series.

Hint : Use Gibbs Phenomenon  

0 0
Add a comment Improve this question Transcribed image text
Answer #1

When 101 harmonics are used:

MATLAB:

clc;
clear all;
close all;
T=4;t=0:0.01:T;A=10;
x=A.*(t>=0 &t<=2)

%To caclculate fourier series coefficients of x(t)
w0=2*pi/T;N=50
k=0;
for n=-N:1:N
k=k+1;
a(k)=(trapz(t,x.*exp(-j*n*w0*t)));
end
a=a/T;n=-N:1:N;

%output xN(t)
k=0;
w0=2*pi/T;
for t=0:0.01:T
k=k+1;
xN(k)=sum(a.*(exp(j*n*w0*t)));
end
t=0:0.01:T;
plot(t,xN,'r',t,x,'b')
title('Fourier approx of squre wave for N=101')
xlabel('t')
ylabel('xN(t)')

stepinfo(real (xN))

Fourier approx of squre wave for N=101 12 4 2 -2 2 3 4

Command window:

RiseTime: 0
SettlingTime: 400.9515
SettlingMin: -0.8645
SettlingMax: 5.0000
Overshoot: 117.2936
Undershoot: 17.2901
Peak: 10.8647
PeakTime: 198

% overshoot:

overshoot -100%=117.29-100%=17.29%

___________________________________________________________________________

When 401 harmonics are used:

MATLAB:

clc;
clear all;
close all;
T=4;t=0:0.01:T;A=10;
x=A.*(t>=0 &t<=2)

%To caclculate fourier series coefficients of x(t)
w0=2*pi/T;N=200
k=0;
for n=-N:1:N
k=k+1;
a(k)=(trapz(t,x.*exp(-j*n*w0*t)));
end
a=a/T;n=-N:1:N;

%output xN(t)
k=0;
w0=2*pi/T;
for t=0:0.01:T
k=k+1;
xN(k)=sum(a.*(exp(j*n*w0*t)));
end
t=0:0.01:T;
plot(t,xN,'r',t,x,'b')
title('Fourier approx of squre wave for N=401')
xlabel('t')
ylabel('xN(t)')

stepinfo(real (xN))

Command window:

RiseTime: 0
SettlingTime: 400.9799
SettlingMin: -0.0250
SettlingMax: 5.0000
Overshoot: 100.5000
Undershoot: 0.5000
Peak: 10.0250
PeakTime: 201

% overshoot:

Overshoot -100%=100.5-100%=0.5%

Fourier approx of squre wave for N-401 12 10 6 4 2 4 -2

_________________________________________________________________________

To achieve 9% overshoot

clc;
clear all;
close all;
T=4;t=0:0.01:T;A=10;
x=A.*(t>=0 &t<=2)

%To caclculate fourier series coefficients of x(t)
w0=2*pi/T;
k=0;
for n=-180:1:181
k=k+1;
a(k)=(trapz(t,x.*exp(-j*n*w0*t)));
end
a=a/T;n=-180:1:181

%output xN(t)
k=0;
w0=2*pi/T;
for t=0:0.01:T
k=k+1;
xN(k)=sum(a.*(exp(j*n*w0*t)));
end
t=0:0.01:T;
plot(t,xN,'r',t,x,'b')
title('Fourier approx of squre wave for N=362')
xlabel('t')
ylabel('xN(t)')

stepinfo(real (xN))

Fourier approx of squre wave for N-362 12 10 6 4 2 4 -2

Command window:

RiseTime: 2.8422e-14
SettlingTime: 400.9781
SettlingMin: -0.4610
SettlingMax: 5.0000
Overshoot: 109.2182
Undershoot: 9.2199
Peak: 10.4609
PeakTime: 200

% overshoot:

Overshoot -100%=109.21-100%=9.21%

Observation

For 362 harmonics , the overshoot in % is 9.21%

For 401 harmonics , the overshoot in % is 0.5%

For 101 harmonics , the overshoot in % is 17.29%

Add a comment
Know the answer?
Add Answer to:
Please Solve this Question anyway either by using MATLAB or any other way ..... QUESTION : Generate a square wave with p...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT