How Do I Set Boundaries on MATLAB Graphs?

  • Context: MATLAB 
  • Thread starter Thread starter bear_25
  • Start date Start date
  • Tags Tags
    Matlab Plotting
Click For Summary

Discussion Overview

The discussion revolves around how to set boundaries on MATLAB graphs, particularly focusing on plotting specific graphs and managing graphical boundaries within MATLAB's Command Window. Participants share their experiences and seek assistance with MATLAB plotting techniques.

Discussion Character

  • Homework-related
  • Technical explanation
  • Exploratory

Main Points Raised

  • One participant expresses confusion about how to write commands in MATLAB to plot two graphs.
  • Another participant suggests that the original poster is looking to plot the graphs and mentions the plotregion function from the File Exchange as a potential solution for plotting shaded regions.
  • A participant indicates that they cannot provide a full tutorial but directs the original poster to MATLAB's documentation for plotting functions.
  • A participant shares a MATLAB code snippet that generates three graphs based on specific parameters and calculations, but notes they are unsure how to set boundaries for the graphs as shown in attached images.

Areas of Agreement / Disagreement

Participants do not reach a consensus on how to set boundaries for the graphs, and multiple approaches and suggestions are presented without resolution.

Contextual Notes

There are limitations in the discussion regarding the specifics of the boundary-setting process in MATLAB, as well as the lack of clarity on the exact requirements of the graphs being referenced.

bear_25
Messages
5
Reaction score
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: 548
Physics news on Phys.org
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?
 
Thanks.

no, i am confused how to write this in Command Window in MATLAB, because for now i just start to use MATLAB.
 
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?
 
well, i need to plot this two graph in MATLAB, but i don t know how.
 
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
 
Can you tell me how can i plot the boundaries? I really need help.
 
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.
 
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
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
4K
Replies
6
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K