cosine of a matrix returns weird values.

5 次查看(过去 30 天)
I'm trying to plot a few forces that chance because of an angle. I've defined the changing angle as beta which is a matrix. Than i'm calcultating two different angles which matter for the calculation of the forces. And for these forces i need, for example, the cosine of angle alpha. The angle of alpha changes between 90 and 0 degrees. But if i take the cosine of this matrix it returns weird numbers. Negative numbers, like -0.4481. It should start at 90 and cosine 90 equals 0 but it doesn't. Does anyone know what is going on?
Fad = 240
Fad = 240
beta = 0:1:180; % Angles
gamma = 180 - beta;
alpha = 0.5.*gamma;
w = cos(alpha); % Cosine and tanges of said angles
x = cos(gamma);
y = tan(alpha);
z = tan(gamma);
Fvloer1 = Fad./w; % Calculations of different forces
Fvloer2 = Fvloer1.*x; % Almost all forces are matrices except for Fad which is a constant.
Fl = Fad.*y;
Ft = Fvloer2.*z;
figure % Plots of these forces against an angle
plot(beta,Fvloer1)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on
figure
plot(beta,Fvloer2)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on
figure
plot(beta,Fl)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on
figure
plot(beta,Ft)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on

采纳的回答

Torsten
Torsten 2025-1-20
编辑:Torsten 2025-1-20
"cos" and "tan" can be applied to angles in radians, not in degrees. Use "cosd" and "tand" instead.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Install Products 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by