Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Plotting in MATLAB

  1. Sep 13, 2011 #1
    Hello, i am new in using MATLAB, and i stuck with these two graphs (attached). Can anyone help me, please. Thank you.
     

    Attached Files:

  2. jcsd
  3. Sep 13, 2011 #2

    Hootenanny

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Welcome to Physics Forums.

    What exactly are you stuck with? Are you trying to plot them?
     
  4. Sep 13, 2011 #3
    Thanks.

    no, i am confused how to write this in Command Window in MATLAB, because for now i just start to use MATLAB.
     
  5. Sep 13, 2011 #4

    Hootenanny

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    I'm afraid that I still don't understand. What exactly are you trying to do?
     
  6. Sep 13, 2011 #5
    well, i need to plot this two graph in MATLAB, but i don t know how.
     
  7. Sep 13, 2011 #6

    Hootenanny

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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
     
  8. Sep 13, 2011 #7
    Can you tell me how can i plot the boundaries? I really need help.
     
  9. Sep 13, 2011 #8

    Hootenanny

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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.
     
  10. Sep 13, 2011 #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
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Plotting in MATLAB
  1. Plotting in Matlab (Replies: 2)

  2. Plotting in matlab (Replies: 0)

  3. MATLAB plots (Replies: 1)

  4. Matlab Plot (Replies: 2)

  5. Plotting with MATLAB (Replies: 1)

Loading...