Ask your own question, for FREE!
Mathematics 24 Online
OpenStudy (zephyr141):

Can someone help me with MatLab?

OpenStudy (zephyr141):

The displacement of the slider of the slider-crank mechanism is given by, \[s=a*\cos(\phi)+\sqrt{b^2-(a*\sin(\phi)-e^2)}\]Plot the displacement as a function of the angle phi (in degrees)when a=1, b=1.5, e=0.5, and\[0\le \phi \le 360\]

OpenStudy (zephyr141):

that is, use [ plot ( phi , s ) ]

OpenStudy (zephyr141):

so far this is what i did

OpenStudy (zephyr141):

syms phi a=1 b=1.5 e=0.5 phi=linspace(0,360) s=((a*cos(phi)+sqrt(b^2-(a*sin(phi)+e^2)))

OpenStudy (zephyr141):

thisis what the slider-crank mechanism looks like.

OpenStudy (zephyr141):

it tells me that i have a conflict with the variables. i guess it has to do with the s=f(phi) when i plug it into plot(phi,s) in the end. but i don't know how to fix it.

OpenStudy (anonymous):

Trigonometric functions in matlab (sin, cos,...) assumed the angles in radians, so to convert to radians multiply phi by pi and divided by 180

OpenStudy (zephyr141):

ok so i did this now: syms phi U a=1 b=1.5 c=0.3 phi=linspace(0, 2*pi) U=(Phi*pi)/180 s=(a*cos(U)+sqrt(b^2-(a*sin(U)-e)^2)) plot(U,s) it gives me this error message: error using ^ inputs must be scalar and a square matrix. to compute otherwise POWER, use POWER (.^) instead. Error in homework1 (line 22) s=(a*cos(U)+sqrt(b^2-(a*sin(U)-e)^2))

OpenStudy (phi):

phi and U will be vectors when you do cos(U), you get back a vector (a cosine value for each number in U) you can multiply the vector by a constant, matlab will multiply each number in the vector by the constant. however, you also have -e^2 and b^2 that you are adding. matlab does not know how to do that. you will have to make a vector of the same size as U, doing (for example) b_vec= b^2*ones(sizeof(U)) do the same for e^2 or combine them: be_vec= (b^2+e^2)*ones(sizeof(U))

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!