Invalid expression please fix :(
6 ビュー (過去 30 日間)
古いコメントを表示
%given data
a = 45; % Angle in degrees
P = 100; % Load in Newtons
h = 1.0; % Truss height in meters
% Calculate horizontal and vertical components of the load
P_horizontal = P * cosd(a);
P_vertical = P * sind(a);
% Calculate reactions at supports
G_x = P_horizontal;
G_y = P_vertical;
% Calculate forces in members
BC_y = G_y;
BC_x = 0;
CL_y = BC_y;
CK_y = 0;
CD_x = 0;
EF_x = 0;
EF_y = 0;
KL_x = 0;
KL_y = 0;
% Display results
fprintf('Forces in Members:\n');
fprintf('BC: %.2f N (compression)\n', BC_y);
fprintf('CL: %.2f N (tension)\n', CL_y);
fprintf('CK: Zero force member\n');
fprintf('CD: %.2f N (tension)\n', CD_x);
fprintf('KL: Zero force member\n');
fprintf('EF: Zero force member\n');
12 件のコメント
Walter Roberson
2023 年 9 月 17 日
One of the moderators edited your post to format your code and run it here on MATLAB Answers. Because of that, your Question is now effectively a screen capture of the output of the code as if you had run it as a Livescript.
回答 (1 件)
Image Analyst
2023 年 9 月 17 日
"can send screenshots of code running that would be helpful".
It runs fine in r2023a and r2023b (see below). Now it's your turn to attach screenshots.

0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Text Analytics Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!