Differentiating and Integrating in MATLAB

2 views (last 30 days)
Natalie
Natalie on 17 Nov 2013
Commented: Natalie on 17 Nov 2013
Hello,
I want to differentiate then integrate the following function. Then I want to evaluate the function from infinity to V
clear;
clc;
syms T R Tc V b w
P=(R*T/(V-b))-(1+(1-sqrt(T/Tc))*(0.37464+1.5422*w-0.26992*w^2)^2)/(V^2-2*b*V-b^2)
M=diff(P,T)
N=diff(P,V)
m1=@(V) V*M+T*N
H=integral(m1, inf, V)
However, when I do so I get the result:
Error using integral (line 86)
A and B must be floating point scalars.
Error in Untitled9 (line 8)
H=integral(m1, inf, V)
The differentiation part works fine. But when I try to integrate the result I get the above response. Any help would be appreciated thanks.

Answers (1)

Walter Roberson
Walter Roberson on 17 Nov 2013
diff() is for symbolic differentiation, but the symbolic integration is int() not integral()
  1 Comment
Natalie
Natalie on 17 Nov 2013
Oh okay. So I have another question. When MATLAB integrates the M and N is it integrating what they are equal to? Because I want to be able to put eventually put numerical values into the code.

Sign in to comment.

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!