how to solve an equation where the unknown is an integration boundry for a numerical integration?

I need to solve this equation in the form for x where A is a constant and f a known function, which has to be integrated numerically.
However, when i define this function and try to solve, i get the error
"Error using integral (line 85)
A and B must be floating-point scalars."
Apparently I cannot put the variable I need to solve for in the boundry of the integral.
How can this be done?
Below is the code. I know, it is a lot of constants.
P_ep = @(z) P_c.*(((exp(-(1/4).*(z./omega_c).^(5/12))).*((z./omega_c).^(3./2)))+(((4./C).*(2.84-0.92.*(1-cos(pi.*((sqrt(R.*z.*(z./(1.9.*omega_c)).^(0.14.*exp(23.*(S_y./E)))))./R))))).*(1-exp(-(1./25)*(z./omega_c).^(5./9))).*(z./omega_c)));
syms omega_m_ep
omega_m = solve(integral(P_ep,omega_c,omega_m_ep) == (0.5 * m * V_1 ^2)- ((8/15)*E*sqrt(R)*omega_c^(5/2)),omega_m_ep);

7 Comments

This happens because of solve. It's for symbolic calculations. You have complicated equation. Use fsolve to suceed
I have tried the same thing using fsolve, but it still does not work. The error code appears to originate from evaluating the integral, not from the solver.
P_ep = @(z) P_c.*(((exp(-(1/4).*(z./omega_c).^(5/12))).*((z./omega_c).^(3./2)))+(((4./C).*(2.84-0.92.*(1-cos(pi.*((sqrt(R.*z.*(z./(1.9.*omega_c)).^(0.14.*exp(23.*(S_y./E)))))./R))))).*(1-exp(-(1./25)*(z./omega_c).^(5./9))).*(z./omega_c))); % (9), with substituted in (sqrt(8/pi),10,11 and 12)
omega_m = fsolve(integral(P_ep,omega_c,omega_m_ep) - (0.5 * m * V_1 ^2)+ ((8/15)*E*sqrt(R)*omega_c^(5/2)),0);
note that all the things in these equations are constants with a known value, exept omega_m
You need to pass fslove a function handle, and that function handle then needs to call integral.

Sign in to comment.

 Accepted Answer

You need to pass fslove a function handle, and that function handle then needs to call integral.
This solved the problem, Thank you both

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Products

Release

R2017b

Community Treasure Hunt

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

Start Hunting!