I have no idea what to do
1 view (last 30 days)
Show older comments
I would like to change this code as shown in the following image. I've drawn it up to this point, but what should I do with the details?
Sig_x = 3
Sig_y = 0
Tau_xy = 2
% R:Radius of a Circle ==================
R = sqrt((Sig_x- Sig_y)^2/4+Tau_xy^2);
% Center of the Mohr's Stress Circle ====
Sig_xc =(Sig_x+ Sig_y)/2
Sig_yc = 0
Theta = atand(Tau_xy/(Sig_x-Sig_xc))/2
% Principal stresses ====================
Sig_1 = Sig_xc + R
Sig_2 = Sig_xc - R
% Max shear stress ======================
Tau_max = R
%===== Making Mohr's Circle =============
x=-pi:pi/180:pi;
x1 = R*cos(x)+Sig_xc;
y1 = R*sin(x)+Sig_yc;
plot(x1,y1)
title('Make a Mohr stress Circle with R')
xlabel('Normal stresses \sigma')
ylabel('Shear stress \tau')
grid on
axis ([Sig_xc-R, Sig_xc+R, -2-R, 2+R])
axis equal, hold on
% =========================================
plot([0 0], [-2-R, 2+R]) % y-축
plot([Sig_xc-2*R Sig_xc+2*R], [0 0]) % x-축
%=========================================
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1533092/image.png)
0 Comments
Answers (1)
Mann Baidi
on 8 Nov 2023
Hi,
I understand that you would like to add figures and text over the plot.
For adding symbols or text on a figure, you can use the "text" function in MATLAB.
You can customize the text and symbols by referring to the following link.
For marking the specific points in the graph, you can add the following code to your script
plot(0,0,"ro","MarkerFaceColor","red","MarkerSize",4)
And lastly, for adding the square in your graph, you can add the following code in the graph.
hold on
rectangle('Position',[4 -4 2 2]) % the first two values are the position of the bottom left corner followed by length and width
Here is a modified version of your code
Sig_x = 3
Sig_y = 0
Tau_xy = 2
% R:Radius of a Circle ==================
R = sqrt((Sig_x- Sig_y)^2/4+Tau_xy^2);
% Center of the Mohr's Stress Circle ====
Sig_xc =(Sig_x+ Sig_y)/2
Sig_yc = 0
Theta = atand(Tau_xy/(Sig_x-Sig_xc))/2
% Principal stresses ====================
Sig_1 = Sig_xc + R
Sig_2 = Sig_xc - R
% Max shear stress ======================
Tau_max = R
%===== Making Mohr's Circle =============
x=-pi:pi/180:pi;
x1 = R*cos(x)+Sig_xc;
y1 = R*sin(x)+Sig_yc;
plot(x1,y1)
hold on
plot(0,0,"ro","MarkerFaceColor","red","MarkerSize",4)
text(0.2,0,"Origin")
title('Make a Mohr stress Circle with R')
xlabel('Normal stresses \sigma')
ylabel('Shear stress \tau')
grid on
axis ([Sig_xc-R, Sig_xc+R, -2-R, 2+R])
axis equal,
hold on
% =========================================
plot([0 0], [-2-R, 2+R]) % y-축
plot([Sig_xc-2*R Sig_xc+2*R], [0 0]) % x-축
%=========================================
hold on
rectangle('Position',[4 -4 2 2])
Hope this will help in resolving your query!
0 Comments
See Also
Categories
Find more on Stress and Strain in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!