Alternative ways to plot a bode diagram
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm trying to make a Bode diagram of a function. The problem is that said function contains a (j*w)^n inside, where (0.87 < n < 0.93). That means that i cannot use the bode function, the way that works i need all s to have an integer exponential. I tried to use semilog plot:
if true
%defining logspace
f = logspace(0,6,1e6);
w = 2*pi*f;
%the impedance which contains the (j*w)^n
Zel = Rct./(1 + Rct*(1j*w*Cdl).^n);
% defining H
H_num = Rseal*Zload;
H_den = Rseal*Zm + (Zm + Rseal)*(Zload + Zel);
H=H_num./H_den;
%plotting the bode diagram
subplot(2,1,1)
semilogx(f, 20*log10(abs(H)))
subplot(2,1,2)
semilogx(f,unwrap(angle(H))*180/pi)
end
and yet the result was off, while i got a high pass filter as it should be, it was wrong.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/160079/image.png)
this is the result i was expecting:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/160081/image.jpeg)
I tried with symbolic functions too:
if true
% code
syms s f;
s= 1j*(2*pi*f);
H_num = Rseal*Zload;
H_den = Rseal*Zm + (Zm + Rseal)*(Zload + Zel);
H=H_num/H_den;
H_modulo = matlabFunction(20*log10(abs(H)));
H_fase = matlabFunction(radtodeg(phase(H)));
end
and this time i got this, still wrong:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/160082/image.png)
So, while i triple check the values of the parameters and the calculations, someone has any idea of why this isn't working? or just a suggestion on where to look. Thanks in advance for you help.
0 commentaires
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!