Question

9. Use Matlab to calculate the harmonic frequency (nwo), the harmonic amplitude (cn), and the nth phase angle (δ.) for n 0, 1
media%2Fd18%2Fd1897bb1-1998-480f-a0a2-86
9. Use Matlab to calculate the harmonic frequency (nwo), the harmonic amplitude (cn), and the nth phase angle (δ.) for n 0, 1, 2, ...-10 for Problem 1. Plot (cn) and (6n) as a function of (nwo).
0 0
Add a comment Improve this question Transcribed image text
Answer #1

n_max = input('Enter vector of highest harmonic values desired
(odd):');
f = 1;
N = n_max;
t = 0:0.002:1;
omega_0 = 2*pi*f;
x=zeros(size(t));
n=1:1:N;
b_n=zeros(size(n));
for i=1:(N+1)/2;
k=2*i-1;
b_n(k)=4/(pi*k);

figure(1)
subplot(2,1,1),stem(b_n);
xlabel('Integer Multiple of Fundamental Frequency');
ylabel('Amplitude'),grid;
% This part is for plotting the partial Fourier sum
x=x+b_n(k)*sin(omega_0*k*t);
subplot(2,1,2),plot(t,x),xlabel('t'),ylabel('partial sum');
axis([0 1 -1.5 1.5]),text(0.05,-0.5, ['max.har.=',num2str(k)]);
grid;
end

For the first 50 harmonic the below function can be used

Y = fft(i_w,1024)

an = real(Y)
bn = imag (Y)
[r,k]=size(an)


n=50

ann = an(1:n,k)
bnn = bn(1:n,k)
ampl = 2/1024*sqrt(ann.^2+bnn.^2)
phi=atan(ann./(bnn+.000001));
harm = 1:1:n
bar(harm,ampl)
xlabel('harmonics')
ylabel('amplitude')

Add a comment
Know the answer?
Add Answer to:
9. Use Matlab to calculate the harmonic frequency (nwo), the harmonic amplitude (cn), and the nth...
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