Marking a single point on a graph

5 ビュー (過去 30 日間)
Paul Bradford
Paul Bradford 2019 年 6 月 23 日
コメント済み: Star Strider 2019 年 6 月 23 日
This is my code for finding normal and shear stress:
sigma_x = 8;
sigma_y = -12;
tau_xy = -6;
theta = [-90:.05:90];
%Normal Stress
sigma_x1 = ((sigma_x + sigma_y)/2)+(((sigma_x - sigma_y)/2)*(cosd(2*theta)))+(tau_xy*(sind(2*theta)));
sigma_y1 = ((sigma_x + sigma_y)/2)-(((sigma_x - sigma_y)/2)*(cosd(2*theta)))-(tau_xy*(sind(2*theta)));
%Shear Stress
tau_x1y1 = -(((sigma_x - sigma_y)/2)*(sind(2*theta)))+(tau_xy*(cosd(2*theta)));
%plot
plot(theta, tau_x1y1),xlabel('Degree of Rotation'), ylabel('Shear Stress'),title('Shear Stress Based on Rotation')
grid on, axis equal
I need to know how to just mark the points where shear stress = 0.
Thank you.

採用された回答

Star Strider
Star Strider 2019 年 6 月 23 日
This first finds the approximate indices for the zero-crossings, then interpolates to find the exact values:
sigma_x = 8;
sigma_y = -12;
tau_xy = -6;
theta = [-90:.05:90];
%Normal Stress
sigma_x1 = ((sigma_x + sigma_y)/2)+(((sigma_x - sigma_y)/2)*(cosd(2*theta)))+(tau_xy*(sind(2*theta)));
sigma_y1 = ((sigma_x + sigma_y)/2)-(((sigma_x - sigma_y)/2)*(cosd(2*theta)))-(tau_xy*(sind(2*theta)));
%Shear Stress
tau_x1y1 = -(((sigma_x - sigma_y)/2)*(sind(2*theta)))+(tau_xy*(cosd(2*theta)));
zci = @(v) find(v(:).*circshift(v(:), [-1 0]) <= 0); % Returns Approximate Zero-Crossing Indices Of Argument Vector
tauzix = zci(tau_x1y1); % Approximate Zero-Crossing Indices
for k = 1:numel(tauzix)
xval(k) = interp1(tau_x1y1(tauzix(k)-1:tauzix(k)+1), theta(tauzix(k)-1:tauzix(k)+1), 0); % ‘Theta’ Values At Zero-Crossings
end
%plot
plot(theta, tau_x1y1)
hold on
plot(xval, zeros(size(xval)), 'pg')
hold off
xlabel('Degree of Rotation'), ylabel('Shear Stress'),title('Shear Stress Based on Rotation')
grid on, axis equal
  2 件のコメント
Paul Bradford
Paul Bradford 2019 年 6 月 23 日
Worked very well. Thank you.
Star Strider
Star Strider 2019 年 6 月 23 日
As always, my pleasure.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStress and Strain についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by