why the bode function doesn't work?

75 views (last 30 days)
jia ming chen
jia ming chen on 19 Jan 2015
Answered: Felix Götze on 9 Feb 2016
this is my problem...
>> s=tf('s')
s =
s
Continuous-time transfer function.
>> g=1/(1+s)
g =
1
-----
s + 1
Continuous-time transfer function.
>> bode(g) Error using DynamicSystem/bode (line 97) Index exceeds matrix dimensions.
can anyone solve it?

Answers (3)

Felix Götze
Felix Götze on 9 Feb 2016
Hi,
I had the same Problem. In my case the error occured because I had a figure window open. If you have an open figure close it and try the command again it should work properly now.

Youssef  Khmou
Youssef Khmou on 19 Jan 2015
Edited: Youssef Khmou on 19 Jan 2015
The description is correct and the code is working correctly,try clearing the existing variables
clear all;
s=tf('s'); g=1/(1+s); bode(g);
  2 Comments
Youssef  Khmou
Youssef Khmou on 20 Jan 2015
Bode function contains the following code from line 92 through 100
92 case 3
93 % Transfer function form with time vector
94 if size(a,1)>1,
95 % SIMO syntax
96 a = num2cell(a,2);
97 den = b;
98 b = cell(size(a,1),1);
99 b(:) = {den};
100 end

Sign in to comment.


Andreas Goser
Andreas Goser on 20 Jan 2015
Can you verify the output of
which bode -all
Youe should get something like this:
C:\Program Files\MATLAB\R2014b\toolbox\control\ctrlobsolete\bode.m
C:\Program Files\MATLAB\R2014b\toolbox\shared\controllib\engine\@DynamicSystem\bode.m % DynamicSystem method
Is not, there maybe another function or variable shadowing the bode function you want.
  2 Comments
Andreas Goser
Andreas Goser on 19 Mar 2015
This user had a different error message. The solution was a compatibility with a 3rd part toolbox. Once this was removed from the path, BODE was working fine.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!