cosine of a matrix returns weird values.

조회 수: 4 (최근 30일)
Wouter
Wouter 2025년 1월 20일
댓글: Wouter 2025년 1월 20일
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.
  댓글 수: 1
Wouter
Wouter 2025년 1월 20일
Came to the same conclusion, Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (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