Problem with integrals
Show older comments
I have a integral that simplified looks like this:
quad(@(z) exp(z.^2),-2,x)
The problem here is quite obvious. You can't use quad quad a variable as a limit. So why don't I use int? Because exp(z^2) is an analytically unsolvable integral. In the task I'm trying to solve there is a second integral of the first integral and simplified it looks like this:
quad(@(x) exp(x.^2).*quad(@(z) exp(z.^2),-2,x),-2,2)
And according to my mentor there should be a way to solve this because he says that the first integration will make the other one solvable. The code above gives this error:
??? Error using ==> quad at 70
The limits of integration must be scalars.
Error in ==> @(x)exp(x.^2).*quad(@(z)exp(z.^2),-2,x)
Error in ==> quad at 77
y = f(x, varargin{:});
Error in ==> test at 54
quad(@(x) exp(x.^2).*quad(@(z) exp(z.^2),-2,x),-2,2)
So I thought I should ask you if there is a way to do what I'm trying to do (with any command, it does not have to be quad) or if its not possible.
Accepted Answer
More Answers (0)
Categories
Find more on Numeric Solvers 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!