The inbuilt code "bode " is not working
6 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Walter Roberson
2021 年 5 月 27 日
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.
採用された回答
Star Strider
2021 年 5 月 27 日
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 ;
RL2 = 0.15 ;
C1 = 0.042996e-6;
C2 = 0.043091e-6;
Rc1 = 0 ;
Rc2 = 0 ;
Lp = 10e-6;
Ls = 10e-6;
RLp = 0 ;
RLs = 0 ;
Cp = 0.35059e-6;
Cs = 0.35059e-6;
Rcp = 0 ;
Rcs = 0 ;
Vin = 3;
w = 2*pi*85e3;
R = 30;
M=8.9e-6;
k = 1/(L1*L2-M^2);
% iLp iLs Vcp Vcs Vc1 Vc2 iL1 iL2
A = [-(RLp+Rcp)/Lp 0 -1/Lp 0 0 0 Rcp/Lp 0
0 -(R+RLs+Rcs)/Ls 0 -1/Ls 0 0 0 Rcs/Ls
1/Cp 0 0 0 0 0 -1/Cp 0
0 1/Cs 0 0 0 0 0 -1/Cs
0 0 0 0 0 0 1/C1 0
0 0 0 0 0 0 0 1/C2
k*L2*Rcp -k*M*Rcs k*L2 -k*M -k*L2 k*M -k*L2*(RL1+Rc1+Rcp) k*M*(RL2+Rc2+Rcs)
-k*M*Rcp k*L1*Rcs -k*M k*L1 k*M -k*L1 k*M*(RL1+Rc1+Rcp) -k*L1*(RL2+Rc2+Rcs)];
B = [1/Lp 0 0 0 0 0 0 0]';
C = [0 R 0 0 0 0 0 0];
D=[0];
A
B
C
D
figure(1)
hold on;
sys = ss(A,B,C,D)
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File 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!












