Using matlab find the frequencies and amplitudes of the fund
Using matlab, find the frequencies and amplitudes of the fundamental and (2nd, 3rd, 4th and 5th) harmonics of a triangular waveform of 100 kHz frequency, amplitude of 5 Vpp, and 0 V offset.
Please show matlab code.
Solution
clc
clear;
disp(\'given triangular wave\');
disp(\'given frequency is 100KHz\');
h=zeros(5,3);
A=5;
disp(\'hormonic || fequency|| amplitude\');
disp(\' number || KHz || dBV\');
for i=1:5,
h(i,1)=i;
h(i,2)=i*100;
hv=(4*A)/(i*pi)^2;
h(i,3)=-20*log(hv);
end
disp(h);
result
given triangular wave
given frequency is 100KHz
hormonic || fequency|| amplitude
number || KHz || dBV
1.0000 100.0000 -14.1255
2.0000 200.0000 13.6004
3.0000 300.0000 29.8190
4.0000 400.0000 41.3263
5.0000 500.0000 50.2521
