Help with Matlab plotting
古いコメントを表示
Is anybody able to help me with plotting in Matlab? I need to be able to plot a free body diagram with scaled vectors showing the different forces. I'm able to solve the equation in Matlab but am having trouble finding a way to plot it like shown in the picture. Any help would be greatly appreciated. I just need to figure out how to plot the bar at least.
回答 (1 件)
Hasan
2026 年 5 月 20 日 2:17
Here is a basic template
To plot the bar, you can use polyshape:
x = [ 0 , 0 , 18, 18];
y = [-0.5, 0.5, 0.5,-0.5];
beam=polyshape(x,y)
h=plot(beam); hold on;
h.FaceColor=[0,0,0]; h.EdgeColor=[0,0,0]; % Set color to black
axis equal, grid on
To plot an arrow, you can use annotation, like so:
greenarrow = annotation('arrow', 'LineWidth', 5, 'Color', 'g', 'HeadLength', 16, 'HeadWidth', 32);
greenarrow.Parent=gca;
greenarrow.Position=[8,0,0,-2]; % X1 Y1 deltaX deltaY, tip of the arrow is at (x1+deltaX,Y1+deltaY)
(dont forget to use the correct lengths for your freebody diagram)
Finally, you can add a marker for the roller or the hinge like so:
plot(0,-0.5,'.','MarkerSize',46);
axis equal, grid on, box on

This should be enough to help you get started
カテゴリ
ヘルプ センター および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!