how to write symbolic integral
Mostrar comentarios más antiguos
I want to use the symbolic function `int` to find the indefinite integral of the function 4*x^2+3, and the definite integral from x = -1 to x = 3. here is my approach, but got an error:
int(4*x^2+3)
int(4*x^2+3, x = -1..3)
>> problem8
Undefined function or variable 'x'.
Error in problem8 (line 1)
int(4*x^2+3)
I followed the documentation of int to write these expressions, but I don't know why it doesn't work, just new to symbolic functions in MATLAB.
Then I reasearched, and added syms x in the first line.Now the first expression works, but the second definite integral still doesn't work.What should I do? Now the error is
syms x
int(4*x^2+3)
int(4*x^2+3, x = -1..3)
>> problem8
Error: File: problem8.m Line: 3 Column: 16
The expression to the left of the equals sign is not a valid target for an assignment.
It's quite awkward of the syntax x = -1..3, not anything like what I learnt in MATLAB.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Code Performance en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!