MATLAB Need help with integration and plotting

Click For Summary
SUMMARY

The discussion centers on integrating the equation dy = (1/x)dx and plotting the result using MATLAB. The user initially attempts to use symbolic integration with the commands syms y x, LHS = int(1,y), and RHS = int(1/x,x). A suggestion is made to reformulate the equation to (1/y)dy = dx for better integration. The user seeks guidance on how to plot y as a function of x after performing the integration.

PREREQUISITES
  • Familiarity with MATLAB syntax and commands
  • Understanding of symbolic integration in MATLAB
  • Knowledge of plotting functions in MATLAB
  • Basic calculus concepts, particularly integration
NEXT STEPS
  • Explore MATLAB's int function for symbolic integration
  • Learn how to use fplot for plotting functions in MATLAB
  • Research the use of syms for defining symbolic variables in MATLAB
  • Investigate the implications of changing differential equations for integration
USEFUL FOR

Students, engineers, and researchers who are using MATLAB for mathematical modeling, particularly those focusing on integration and plotting functions.

sarrfriend
Messages
6
Reaction score
0
Hi,
I have been trying to integrate an equation and then plot the result using MATLAB but haven't figured out how to do it. Say, I have an equation of the form dy = (1/x)dx. I want to integrate the above equation and then plot y as a function of x. So, to integrate I do this:

syms y x
LHS = int(1,y);
RHS = int(1/x,x);

So, now LHS and RHS contain the corresponding results of the integrals. How do I plot y as a function of x?

Thanks in advance.

Sarrvesh
 
Physics news on Phys.org
It would be better if you could use the following equation instead of the one written above: (1/y)dy = dx. Now, how do I plot y as a function of x after integrating?
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K