Integration with variable limit
4 views (last 30 days)
Show older comments
Hope you all are fit and sailing the storm perfectly.
I need help in writing a MATLAB code for the problem attached herewith .
I shall be thankful to you.
Thank you,
Vivek Sharma
7 Comments
Walter Roberson
on 16 Jun 2021
I do not see any 2D integration in the pdf? I only see simple integrals of x*dt for t ranges
Answers (1)
Walter Roberson
on 16 Jun 2021
x=0.01
That x is numeric
for i=1:m
That assigns i as a numeric variable.
T_equ(i)=(T_1+T_2(i))/2;
That assigns to T_equ() indexed at the numeric variable i
syms T_2(i) T_eq(i)
That declares that T_2 and T_eq are symbolic functions with argument i . This will not be the numeric i : this will reassign i to be an (unresolved) symbolic variable. The line there is equivalent to
i = sym('i');
T_2 = symfun('T_2(i)', i);
T_equ = symfun('T)equ(i)', i);
Notice that the numeric i is gone after this.
f=x;
x is numeric, so f will be numeric
T_2max=T_2(i);
That will invoke the symbolic function T_2 with parameter i (which is symbolic now). The result will be the unresolved T_2(i) except it will not be a symbolic function that is returned.
int(f,T_2(i),T_2min, T_2max);
f will be numeric. int() is not defined for a numeric first parameter.
If you were to use
int(sym(f),T_2(i),T_2min, T_2max);
then you would be set up to try to integrate the symbolic value 1/100 with respect to the variable T_2(i) with particular lower and upper bound. But T_2(i) is the symbolic function call T_2(i) rather than being a simple variable, and int() does not permit integrating with respect to a function call.
I do not know why you are going through all that trouble?
syms t T T__2
int(sym(x), t, T__2, T)
See Also
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!