Plotting Graphs in MATLAB: Help Needed

In summary: MATLAB, but i don t know how.I'm afraid that I still don't understand. What exactly are you trying to do?
  • #1
bear_25
5
0
Hello, i am new in using MATLAB, and i stuck with these two graphs (attached). Can anyone help me, please. Thank you.
 

Attachments

  • img001.jpg
    img001.jpg
    25.4 KB · Views: 491
Physics news on Phys.org
  • #2
bear_25 said:
Hello, i am new in using MATLAB, and i stuck with these two graphs (attached). Can anyone help me, please. Thank you.
Welcome to Physics Forums.

What exactly are you stuck with? Are you trying to plot them?
 
  • #3
Thanks.

no, i am confused how to write this in Command Window in MATLAB, because for now i just start to use MATLAB.
 
  • #4
bear_25 said:
Thanks.

no, i am confused how to write this in Command Window in MATLAB, because for now i just start to use MATLAB.
I'm afraid that I still don't understand. What exactly are you trying to do?
 
  • #5
well, i need to plot this two graph in MATLAB, but i don t know how.
 
  • #6
bear_25 said:
well, i need to plot this two graph in MATLAB, but i don t know how.
So you do want to plot these, like I said earlier.

I'm not aware of any in-built function to plot shaded regions (you could plot the boundaries quite easily). However, the plotregion function from the File Exchange would likely do what you need: http://www.mathworks.com/matlabcentral/fileexchange/9261-plot-2d3d-region
 
  • #7
Can you tell me how can i plot the boundaries? I really need help.
 
  • #8
bear_25 said:
Can you tell me how can i plot the boundaries? I really need help.
I can't give you a full tutorial on MATLAB plotting. Instead, have a look at this: http://www.mathworks.co.uk/help/techdoc/ref/plot.html , try somethings and come back with specific questions.
 
  • #9
Well, i have done this graph in MATLAB:
rA = 25;
kA = 2;
hAmax = 7;

rB = 40;
kB = 4;
hBmax = 27;

rC = 60;
kC = 5;
hCmax = 55;

R = 200;

i = 0;
%%
for dR = 0:0.001:4
i = i + 1;
hA(1,i) = rA*(1 - cos(asin((sqrt(2*R*dR + dR.^2) + rA*sin(acos((rA - kA)/rA)))/rA))) - kA;
hB(1,i) = rB*(1 - cos(asin((sqrt(2*R*dR + dR.^2) + rB*sin(acos((rB - kB)/rB)))/rB))) - kB;
hC(1,i) = rC*(1 - cos(asin((sqrt(2*R*dR + dR.^2) + rC*sin(acos((rC - kC)/rC)))/rC))) - kC;
end

%%
hA(hA<0) = 0;
hA(abs(hA)>hAmax) = hAmax;

hB(hB<0) = 0;
hB(abs(hB)>hBmax) = hBmax;

hC(hC<0) = 0;
hC(abs(hC)>hCmax) = hCmax;

%%
figure
plot(0:0.001:4,hA,'r')
hold on
plot(0:0.001:4,hB,'b')
plot(0:0.001:4,hC,'k')
xlabel('Bočna deformacija, dR/mm')
ylabel('Visina krojne naslage, h/mm')
grid on

Now i need to get those two graphs but i don t know how to set boundaries inside the graphs which are attached
 

1. How do I plot a graph in MATLAB?

To plot a graph in MATLAB, you can use the "plot" function. First, create a vector or matrix of the data points you want to plot. Then, use the "plot" function with the appropriate arguments to specify the x and y values. You can also add labels, titles, and customize the appearance of the graph using additional functions.

2. How do I plot multiple graphs on the same figure in MATLAB?

To plot multiple graphs on the same figure in MATLAB, you can use the "hold" function. This will allow you to plot multiple graphs on the same axis without clearing the previous graph. You can also use the "subplot" function to create multiple axes within one figure and plot different graphs on each axis.

3. Can I save my plotted graph in MATLAB?

Yes, you can save your plotted graph in MATLAB by using the "saveas" function. This function allows you to save the current figure in various file formats such as .png, .jpg, or .fig. You can also use the "print" function to save the graph as an image file directly from the command window.

4. How can I change the appearance of my plotted graph in MATLAB?

To change the appearance of your plotted graph in MATLAB, you can use various functions such as "xlabel", "ylabel", and "title" to add labels and titles to your graph. You can also use functions like "grid" to add gridlines, "legend" to add a legend, and "xlim" and "ylim" to customize the axes limits.

5. Is there a way to plot 3D graphs in MATLAB?

Yes, you can plot 3D graphs in MATLAB using the "plot3" function. This function works similarly to the "plot" function but allows you to specify a third dimension for your data points. You can also use the "mesh", "surf", and "scatter3" functions to create different types of 3D graphs in MATLAB.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
32
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
841
Back
Top