The inbuilt code "bode " is not working

I was trying to run the bode.
but it showed this.
Error using DynamicSystem/bode (line 96)
Incorrect number of parameters supplied for 'Controllib:plots:strBodeDiagram'. Expected 0 but found 1.
Error in VOUT_VIN_bode (line 42)
bode(sys)
This is my code: (The project name is VOUT_VIN_bode)
[SL: snipped the code for the bode method of DynamicSystem objects. Please do not post MathWorks function files. I also formatted the code above as code instead of text.]
MATLAB Version: 9.8.0.1396136 (R2020a) Update 3
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
How can i fix it???
Can anyone help me to resolve this?
Thank you

4 comentarios

Star Strider
Star Strider el 27 de Mayo de 2021
Please post the relevant parts of the code, and post the Release as well.
jimmygc lin
jimmygc lin el 27 de Mayo de 2021
Editada: jimmygc lin el 27 de Mayo de 2021
got it. Thanks
You probably have a function on your path that is interfering with one of the functions used by bodeplot() [which is called by bode()] . It would take a bunch of debugging to figure out exactly where the problem was. Using
dbstop if caught error
would help.
But before you do that, experiment with
restoredefaultpath; rehash toolboxcache
if the code works after that, then definitely something on your MATLAB path is interfering.
jimmygc lin
jimmygc lin el 28 de Mayo de 2021
Editada: jimmygc lin el 28 de Mayo de 2021
I run this restoredefaultpath; rehash toolboxcache it didn't work.
after that i run dbstop if caught error And then run my code.
this code is in (matlab\toolbox\shared\controlib\general\+ctrlMsgUtils\message.m)
and then i click continue
this code is in (matlab\toolbox\shared\controlib\general\+ctrlMsgUtils\message.m)
and then i click continue
this code is in (matlab\toolbox\shared\controlib\engine\@DynamicSystem\bodeplot.m)
and then i click continue
this code is in (matlab\toolbox\matlab\helptools\+helpUtils\+csh\helpviewFactory.m)
and then i click continue
this code is in (matlab\toolbox\shared\controlib\engine\@DynamicSystem\bode.m)
and then

Iniciar sesión para comentar.

 Respuesta aceptada

The same code works here, and runs without error, with either bode or bodeplot.
I switched from bode to bodeplot because bodeplot has more options. I also deleted the bode function code here.
L1 = 91.54e-6;
L2 = 91.36e-6;
RL1 = 0.16 ;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 2.852e+06 0 0 0 0 0 -2.852e+06 0 x4 0 2.852e+06 0 0 0 0 0 -2.852e+06 x5 0 0 0 0 0 0 2.326e+07 0 x6 0 0 0 0 0 0 0 2.321e+07 x7 0 0 1.103e+04 -1074 -1.103e+04 1074 -1765 161.2 x8 0 0 -1074 1.105e+04 1074 -1.105e+04 171.9 -1658 B = u1 x1 1e+05 x2 0 x3 0 x4 0 x5 0 x6 0 x7 0 x8 0 C = x1 x2 x3 x4 x5 x6 x7 x8 y1 0 30 0 0 0 0 0 0 D = u1 y1 0 Continuous-time state-space model.
opts = bodeoptions;
opts.Grid = 'on';
bodeplot(sys, opts) % ---------------This is the (line 42)
I do not advise copying the code for bode or any other MATLAB functions and including them with your own code, since they likely have other dependencies that they may not be able to easily locate from the directories that run your code. Run them as functions from the directories where they were installed. If the code you posted is the code that threw the error, this could be the problem.
.

9 comentarios

jimmygc lin
jimmygc lin el 28 de Mayo de 2021
i run the code which you changed the bode to bodeplot but it didn't work.
and I use a example of bode in the matlab
H = tf([1 0.1 7.5],[1 0.12 9 0 0]);
bode(H)
it didn't work too. Then i type dbstop if caught error
It shows this.
this code is in (matlab\toolbox\shared\controlib\general\+ctrlMsgUtils\message.m)
and then i click continue
this code is in (matlab\toolbox\shared\controlib\general\+ctrlMsgUtils\message.m)
and then i click continue
this code is in (matlab\toolbox\shared\controlib\engine\@DynamicSystem\bodeplot.m)
and then i click continue
this code is in (matlab\toolbox\matlab\helptools\+helpUtils\+csh\helpviewFactory.m)
and then i click continue
this code is in (matlab\toolbox\shared\controlib\engine\@DynamicSystem\bode.m)
and then
Star Strider
Star Strider el 28 de Mayo de 2021
At this point, either Contact Support or uninstall and reinstall MATLAB and the Toolboxes.
Include the URL to this thread in your message to Tech Support so that you do not have to repeat everything here, and Tech Support knows what we suggested.
jimmygc lin
jimmygc lin el 28 de Mayo de 2021
I see.Thank you.
Star Strider
Star Strider el 28 de Mayo de 2021
My pleasure!
You could try stepping one line at time in bodeplot starting from line 60
I find it odd that it mentions 'Controllib:plots:strBodeDiagram' . There are only four references to that in the code (between various functions), and the references are all within
getString(message('Controllib:plots:strBodeDiagram'))
ans = 'Bode Diagram'
or
ctrlMsgUtils.message('Controllib:plots:strBodeDiagram')
ans = 'Bode Diagram'
It should not be possible for that particular string to show up as the name of a function, as far as I can see at the moment.
jimmygc lin
jimmygc lin el 29 de Mayo de 2021
@Walter Roberson I really appreiate it. I reinstall the matlab.
then it worksssss^^^^^^ i would do what you said next time.
Thank you soooo much.
Star Strider
Star Strider el 29 de Mayo de 2021
@jimmygc lin Actually, I suggested uninstalling and reinstalling MATLAB in my previous Comment!
As always, my pleasure!
jimmygc lin
jimmygc lin el 30 de Mayo de 2021
@Star Strider YEPP!! THANK YOU SOO MUCH.
Star Strider
Star Strider el 30 de Mayo de 2021
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with Control System Toolbox en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 27 de Mayo de 2021

Editada:

el 1 de Jul. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by