The inbuilt code "bode " is not working in my matlab.

10 views (last 30 days)
When I try to enter a simple program like
N=[100 2e3 1e4]; D=[1e-6 1e-4 1 0 0]; bode(N,D)
It shows an error as below.
Error using freqfocus
Too many input arguments.
Error in ltipack.ltidata/freqresp (line 75)
FocusInfo = freqfocus(Grade,w,mag.*exp(1i*ph),z,p,Ts,linDelay,[]);
Error in resppack.ltisource/magphaseresp (line 34)
[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)
Can anyone help me to resolve this?
Thank you
  12 Comments
Walter Roberson
Walter Roberson on 29 Sep 2016
Could you confirm that you are getting that message about damp even when you are doing just
N=[100 2e3 1e4]; D=[1e-6 1e-4 1 0 0]; bode(N,D)
?
Please post the entire error message, everything in red.
Brindha chellaiah
Brindha chellaiah on 30 Sep 2016
Yes Walter, Following is the error message
Error using freqfocus (line 38)
Simulink model 'damp' was called with incorrect number of arguments
Error in ltipack.ltidata/freqresp (line 74)
FocusInfo = freqfocus(Focus,Grade,w,mag.*exp(1i*ph),z,p,Ts,linDelay,[]);
Error in resppack.ltisource/magphaseresp (line 34)
[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 137)
In DynamicSystem/bode (line 93)
In bode (line 129)_
|

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 30 Sep 2016
In some situations, Simulink models in your path can have priority over .m files of the same name. See https://www.mathworks.com/help/matlab/matlab_prog/function-precedence-order.html :
8. Loaded Simulink® models
9. Functions in the current folder
10. Functions elsewhere on the path, in order of appearance
So from that part alone, we can see that if you have a loaded model named "damp" then it is going to take priority over functions in the current folder or functions elsewhere on the path.
When it comes to looking in any one folder, we see:
3. Simulink model files that are not loaded, with file types in this order:
a) SLX file
b) MDL file
7. Program file with a .m extension
We see from this that in any one directory damp.slx and damp.mdl would have priority over damp.m . But we also see from this is that when you are searching along the MATLAB path, if a damp.slx or damp.mdl is encountered and no damp.m has been encountered yet (because it is further along the path), then the damp.slx or damp.mdl will be used
If you have a loaded model named "damp", then there is not much that can be done except to rename the model.
If you do not have a loaded model named "damp", then what you need to do is use
which damp
which will tell you which directory it is finding the damp.slx or damp.mdl in. Then use pathtool to remove that directory from your MATLAB path or ensure that it is further along the path than toolbox/shared/controllib/engine/ is , If the damp.slx or damp.mdl is in your current directory, change directories or move it or rename it.
  1 Comment
Brindha chellaiah
Brindha chellaiah on 3 Oct 2016
@walter: Thanks a lot for your detailed answer. this one solved my problem. My error is I had a loaded model named damp.slx

Sign in to comment.

More Answers (0)

Categories

Find more on Multicore Processor Targets in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!