error with function bode

10 次查看(过去 30 天)
Abdulrahman Emad Al-Badawi
回答: Star Strider 2020-11-26
So I defined my transfer function and used the bode function to plot a bode plot but I keep getting this error and a blank output for my bode plot.
Error Message:
rror in resppack.ltisource/magphaseresp (line 36)
[mag,phase,w,FocusInfo] = freqresp(SysData(ct),grade,wspec,true);
Error in wavepack.waveform/draw (line 25)
feval(this.DataFcn{:});
Error in wrfc.plot/draw (line 17)
draw(wf)
Error in wrfc.plot/init_listeners>LocalRefreshPlot (line 79)
draw(this)
Warning: Error occurred while evaluating listener callback.
> In DynamicSystem/bodeplot (line 142)
In DynamicSystem/bode (line 93)
In untitled3 (line 2)
Code:
GU=zpk([-1],[-2 -3 -4],240);
bode(GU);
  3 个评论
Steven Lord
Steven Lord 2020-11-26
That doesn't look like the entire error message. What is the full and exact text (everything displayed in red and/or orange in the Command Window) of the error and/or warning messages you receive when you run your code? The exact text of the messages may include information that will help us determine the problem or at least the next step to take in investigating the problem.
Abdulrahman Emad Al-Badawi
I tried using the bode function with a different transfer function, this time using the function tf([ ],[ ]) instead but it didnt work. This is the error message that I got:
Attempt to execute SCRIPT conv as a function:
/MATLAB Drive/conv.m
Error in freqgrid>LocalAddPhaseExtrema (line 374)
lhs1 = psum(conv(n1,n2),2*[psum(conv(polyder(n2),n1),-conv(polyder(n1),n2)) 0]);
Error in freqgrid (line 162)
w = LocalAddPhaseExtrema(w,z{1},p{1});
Error in ltipack.ltidata/freqresp (line 45)
w = freqgrid(z,p,Ts,Grade,Focus);
Error in resppack.ltisource/magphaseresp (line 36)
[mag,phase,w,FocusInfo] = freqresp(SysData(ct),grade,wspec,true);
Error in wavepack.waveform/draw (line 25)
feval(this.DataFcn{:});
Error in wrfc.plot/draw (line 17)
draw(wf)
Error in wrfc.plot/init_listeners>LocalRefreshPlot (line 79)
draw(this)
Warning: Error occurred while evaluating listener callback.
> In DynamicSystem/bodeplot (line 142)
In Q17_5 (line 2)
Q17_5
Attempt to execute SCRIPT conv as a function:
/MATLAB Drive/conv.m
Error in freqgrid>LocalAddPhaseExtrema (line 374)
lhs1 = psum(conv(n1,n2),2*[psum(conv(polyder(n2),n1),-conv(polyder(n1),n2)) 0]);
Error in freqgrid (line 162)
w = LocalAddPhaseExtrema(w,z{1},p{1});
Error in ltipack.ltidata/freqresp (line 45)
w = freqgrid(z,p,Ts,Grade,Focus);
Error in resppack.ltisource/magphaseresp (line 36)
[mag,phase,w,FocusInfo] = freqresp(SysData(ct),grade,wspec,true);
Error in wavepack.waveform/draw (line 25)
feval(this.DataFcn{:});
Error in wrfc.plot/draw (line 17)
draw(wf)
Error in wrfc.plot/init_listeners>LocalRefreshPlot (line 79)
draw(this)
Warning: Error occurred while evaluating listener callback.
> In DynamicSystem/bodeplot (line 142)
In Q17_5 (line 2)

请先登录,再进行评论。

回答(1 个)

Star Strider
Star Strider 2020-11-26
Rename your ‘conv.m’ file to something else, perhaps to ‘myconv.m’ or to something else that makes sense in the context of its use.

类别

Help CenterFile Exchange 中查找有关 Get Started with Control System Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by