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

Click For Summary

Discussion Overview

The discussion revolves around plotting two functions, volume and pressure, as functions of time using MATLAB. Participants explore how to effectively visualize these functions against each other, particularly focusing on the relationship between volume and pressure over time.

Discussion Character

  • Exploratory
  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant describes their functions for volume (Vc and Ve) and pressure (P) in MATLAB, expressing difficulty in plotting these functions against each other.
  • Another participant suggests plotting the vectors against each other as a potential solution to the problem.
  • The original poster acknowledges the suggestion and indicates they had a similar idea after receiving the response.
  • A later reply notes that sometimes the act of asking a question can lead to finding the answer independently.

Areas of Agreement / Disagreement

Participants do not appear to have reached a consensus on the best method for plotting the functions, but there is agreement on the potential of plotting vectors against each other as a viable approach.

Contextual Notes

The discussion does not clarify the specific challenges faced in implementing the plotting in MATLAB or any assumptions about the functions' behavior or relationships.

Who May Find This Useful

Individuals interested in MATLAB programming, particularly those working on plotting functions and visualizing relationships between variables in scientific contexts.

av8or
Messages
2
Reaction score
0
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);
 
Physics news on Phys.org
av8or said:
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.
Why not just plot the vectors against each other?
 
Simon Bridge said:
Why not just plot the vectors against each other?

I actually had that idea shortly after posting this. Thank you for your response.
 
No worries - sometimes the process of asking a question will produce the answer.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 9 ·
Replies
9
Views
5K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K