Errors with Quad function
2 views (last 30 days)
Show older comments
I am getting an error that I don't know how to fix. Here is the problem that I started with and the error messages that I am getting. Any help would be wonderful!
Question:
The following integral arises in the study of reaction-diffusion equations. It describes the width of repeating patterns in periodic steady state solutions. T(µ) = integral from 0 to 1 of ( µ / sqrt ( F(µ)−F(µz) ) dz. µ is a fixed constant with 0 < µ < 1 and F(x) = x^2 / 2 − x^3 / 3. Find T(0.01) using quad. My professor said that the F(x) is what we need to use µ in, which we will then put into the sqrt in our equation. We have to create a formula where z is the only variable so that we can use that with the quad function.
Errors that I am getting:
Error using /
Matrix dimensions must agree.
Error in
Homework_7>@(z)(mu/(sqrt(((((mu).^2)/2)-(((mu).^3)/3))-((((mu*z).^2)/2)-(((mu*z).^3)/3)))))
Error in quad (line 67)
y = f(x, varargin{:});
Error in Homework_7 (line 82)
quad(Tmu, 0, 1)
0 Comments
Accepted Answer
madhan ravi
on 24 Nov 2018
Edited: madhan ravi
on 24 Nov 2018
>> mu = 0.01
Tmu = @(z)(mu ./ (sqrt(((((mu).^2)/2) - (((mu).^3)/3)) - ((((mu*z).^2)/2) - (((mu*z).^3)/3)))))
integral(Tmu, 0, 1) %changed quad to integral
mu =
0.0100
Tmu =
function_handle with value:
@(z)(mu./(sqrt(((((mu).^2)/2)-(((mu).^3)/3))-((((mu*z).^2)/2)-(((mu*z).^3)/3)))))
ans =
2.2309
>>
2 Comments
madhan ravi
on 24 Nov 2018
Edited: madhan ravi
on 24 Nov 2018
Anytime :) , make sure to accept the answer if it helped you and also be familiar with matlab's element wise operations ,
see
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!