Calculation problem. it gives value instead of array

I want to plot three bar mechanism location graph. So i wrote the formulas but when i tried to calculate teofi, it gives me only one value. The other ones is giving an array. I dont understand the problem. If you help me, i glad.

 Respuesta aceptada

Try using element-wise division ( ./ ) and see if that gives you the expected result.
fi = 20:pi/30:60;
r1 = 0.40;
r2 = 2;
r3 = 2;
r4 = 0.30;
A = sind(fi);
B = cosd(fi) - (r1/r2);
D = (r1/r4) * cosd(fi) - (r1.*2 + r2.*2 - r3.*2 + r4.*2) / (2*r2*r4);
teofi = 2 * atand( (A-(A.*2 + B.*2 - D.*2).*(0.5) ) ./ ( B - D ) )
teofi = 1×382
-90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000

1 comentario

cakirenes
cakirenes el 26 de Mzo. de 2022
thanks bro, you helped me alot.I changed the atand formula also. İf you want to plot, you can plot like this
teofi = 2 * atand( (A + (A.*2 + B.*2 - D.*2).*(0.5) ) ./ ( B - D ) )
plot(fi,teofi)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Introduction to Installation and Licensing en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 26 de Mzo. de 2022

Comentada:

el 26 de Mzo. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by