Inner matrix dimensions must agree
Show older comments
This is my first time using Matlab, so I apologize if this is a noob sort of question that gets asked a thousand times.
Here is my m file:
A1 = 4;
A2 = -2;
B1 = 3;
B2 = 1;
T1 = .1;
T2 = .02;
omega = 40 * pi;
t = linspace(0,5*T1);
overdamped = A1*exp(-t./T1)+A2*exp(-t./T2);
critdamped = A1*exp(-t./T1)+(A2/T1)*t.*exp(-t./T1);
underdamped = exp(-t./T1)*(B1*cos(omega*t.)+B2*sin(omega*t.));
plot (t,overdamped)
I am trying to eventually have m file graph overdamped, critdamped, and underdamped on the same plot. I was trying to just get the first one to graph, which I can if I comment out the "critdamped = " and "underdamped = " lines, but if those are in there it throws the error "inner matrix dimensions must agree."
I'm having trouble seeing any errors - to me it seems like all the variables I am working with in those equations are 1x1, where x and t are the only vectors with dimension greater than 1.
Accepted Answer
More Answers (0)
Categories
Find more on Model Import in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!