![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/908435/image.png)
Difference between bode and my calculation of amplitude of the frequency response
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
raha ahmadi
el 26 de Feb. de 2022
Comentada: Star Strider
el 27 de Feb. de 2022
Hi every one, I want to calculate the frequency response of a system, for example :
I dont know why my answer is different from tf and bode function of MATLAB: I substitute s with jw and use abs function as below: fre=linspace(1e-1,100,100); omg=2*1i*pi.*fre; H=tf([1,0],[1,2,3]); bode(H) figure Hm=(omg)./((omg).^2+2.*omg+3); semilogx(fre,20.*log10(abs(Hm))) (I mean the amplitude part). It seems my calculation is wrong but I need to use my method instead of tf function. How can I fix it? Sorry. I am not an electrical engeering student and perhaps my question is very simple!! many thanks in advance
0 comentarios
Respuesta aceptada
Star Strider
el 26 de Feb. de 2022
The ‘fre’ vector needs to be created in logspace and it then needs to be divided by
because the frequency axis is in rad/sec. Then, it matches reasonably closely to the bode result.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/908435/image.png)
fre=logspace(-1,2,100)/(2*pi);
omg=2*1i*pi.*fre;
H=tf([1,0],[1,2,3]);
bode(H)
figure
Hm=omg./((omg).^2 + 2.*omg + 3);
semilogx(fre*2*pi,20.*log10(abs(Hm)))
.
4 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Waveform Generation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!