matlab programming/error messages

Thread Starter

chrill3123

Joined Apr 21, 2010
9
My function in matlab is:

t=0:0.01:8;
w=1;
y=1-((exp(-0.6*w*t))/(sqrt(1-0.6^2)))*sin(w.*sqrt(1-0.6^2)+acos(0.6));
plot(t,y);
hold on;
w=5;
y=1-((exp(-0.6*w*t))/(sqrt(1-0.6^2)))*sin(w.*sqrt(1-0.6^2)+acos(0.6));
plot(t,y)

but every time I´ll run it I get the following message:

??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> Analytiskt_w0_w5 at 3
y=1-((exp(-0.6*ω*t))/(sqrt(1-0.6^2)))*sin(ω.*t.*sqrt(1-0.6^2)+acos(0.6));

I don´t see where I do wrong:mad:

Any help is appreciated
 

Chrill3

Joined Mar 8, 2010
9
Your code works to me in Matlab R2010b and its output graph is attached.

Iam sorry I gave you the wrong function the correct one is, and with this I get the error message from matlab:

My function in matlab is:

t=0:0.01:8;
w=1;
y=1-((exp(-0.6*w*t))/(sqrt(1-0.6^2)))*sin*t*(w.*sqrt(1-0.6^2)+acos(0.6));
plot(t,y);
hold on;
w=5;
y=1-((exp(-0.6*w*t))/(sqrt(1-0.6^2)))*sin*t*(w.*sqrt(1-0.6^2)+acos(0.6));
plot(t,y)
 

Georacer

Joined Nov 25, 2009
5,181
That doesn't make much sense, now, does it? What is the meaning of the multiplication sin*t. Did you mean sin(t*...)?

Please properly post your function.
 

Chrill3

Joined Mar 8, 2010
9
I did find the solution to this problem it is:
y=1-((exp(-0.6*w*t))/(sqrt(1-0.6^2))).*sin*t*(w.*sqrt(1-0.6^2)+acos(0.6));
I needed an dot after (sqrt(1-0.6^2))).* for the matrix multiplication to work correctly
 
Top