cosine of a matrix returns weird values.

4 vues (au cours des 30 derniers jours)
Wouter
Wouter le 20 Jan 2025
Commenté : Wouter le 20 Jan 2025
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

Réponse acceptée

Torsten
Torsten le 20 Jan 2025
Modifié(e) : Torsten le 20 Jan 2025
"cos" and "tan" can be applied to angles in radians, not in degrees. Use "cosd" and "tand" instead.
  1 commentaire
Wouter
Wouter le 20 Jan 2025
Came to the same conclusion, Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Install Products dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by