Unable to create Bode plot of H(s)=(s+10)/(s(s+5)^2)
60 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Stanley
el 21 de Dic. de 2024 a las 20:16
Comentada: Paul
el 22 de Dic. de 2024 a las 16:34
% Case 1. T(s)=(s + 10)/[s(s + 5)^2]
% Case 1. expanded: (s+10)/(s^3 + 10s^2 + 25s)
num = [1 10];
den = [1 10 25 0];
sys = tf(num,den)
bode(sys)
grid on
Using the above code results in 2 error messages:
Error using DynamicSystem/bode (line 104) Line 104: throw(E)
A and B must be vectors.
Error in Bode_Pole_squared (line 10) -> This refers to: bode(sys)
bode(sys)
The code works without the 's' in the denominator (using (s+5)^2 only.)
2 comentarios
Walter Roberson
el 21 de Dic. de 2024 a las 20:31
I suspect that the problem is something along the lines of you having your own height.m function that is interfering with the MATLAB function. However, I did some tracing in the code, and I cannot see at the moment how the graphics are actually built, and I do not see any calls to height() or similar functions.
You should use
dbstop if caught error
and run again, and see where the problem is showing up.
Respuesta aceptada
Hassaan
el 21 de Dic. de 2024 a las 20:25
Editada: Hassaan
el 21 de Dic. de 2024 a las 20:32
% Define numerator and denominator
num = [1 10];
den = [1 10 25 0];
% Create the transfer function
sys = tf(num, den);
% Display the transfer function
disp(sys);
% Plot the Bode plot
bode(sys);
grid on;
The error you're encountering is due to the fact that the denominator provided in the code is incomplete for representing the transfer function properly in MATLAB. Specifically, the denominator vector [1 10 25 0] corresponds to s^3 + 10s^2 + 25s, but this form may lead to numerical instabilities or issues when attempting to compute the Bode plot because the transfer function has a pole at s=0 (a DC pole).
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
- Technical Services and Consulting
- Embedded Systems | Firmware Developement | Simulations
- Electrical and Electronics Engineering
Feel free to contact me.
1 comentario
Paul
el 21 de Dic. de 2024 a las 22:16
"The error you're encountering is due to the fact that the denominator provided in the code is incomplete for representing the transfer function properly in MATLAB."
As your own answer showed, there is no error.
How would one properly represent this transfer function in MATLAB?
"..., but this form may lead to numerical instabilities or issues when attempting to compute the Bode plot because the transfer function has a pole at s=0 (a DC pole)."
What is the basis of this statement?
Más respuestas (1)
Paul
el 21 de Dic. de 2024 a las 20:24
As shown after the edit of @Walter Roberson, the code runs fine here. Do you see the same output after executing the following commands?
num = [1 10];
den = [1 10 25 0];
sys = tf(num,den)
which tf(num,den)
which bode(sys)
2 comentarios
Paul
el 22 de Dic. de 2024 a las 16:34
The problem probaby lies with a function on your path that is shadowing a same-named function used by the Control System Toolbox.
Ver también
Categorías
Más información sobre Plot Customization 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!