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

[Matlab] Plotting two functions of the same variable against each other

  1. Nov 15, 2012 #1
    I need to make two plots of volume as a function of time vs pressure as a function of time. When plotted the graph will have an enclosed area. I am having trouble on how to have matlab plot these two functions against each other.

    My experience with matlab is having a function defined in a script file. I have not been exposed to using a function m file to define a function and reference it in a script.

    My functions are as follows where (t) is the only variable, everything else is defined earlier in the file. I need to graph P vs Vc and P vs Ve. The order of magnitudes of Vc and Ve is different by 10^-3 hopefully that won't matter.

    Vc =@(t) vc*sin(omega*t);
    Ve =@(t) ve*cos(omega*t);
    A =@(t) Vc(t)/(R*Tc) + vtl/(R*Ttl) + vr/(R*Tr) + Ve(t)/(R*Te);
    P =@(t) M/A(t);
     
  2. jcsd
  3. Nov 15, 2012 #2

    Simon Bridge

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    Why not just plot the vectors against each other?
     
  4. Nov 16, 2012 #3
    I actually had that idea shortly after posting this. Thank you for your response.
     
  5. Nov 16, 2012 #4

    Simon Bridge

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    No worries - sometimes the process of asking a question will produce the answer.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook