Plot a complicated equation

3 views (last 30 days)
David
David on 20 May 2016
Commented: Roger Stafford on 20 May 2016
Hello,
I am trying to plot a complicated equation involving rationals and trigonometric functions. The equation is:
Cm = -m * ((b/a)^2.5 * q^0.5) / (dF/dq)
where,
F = (b/a)^4 * ((2*q^2 - (a^2/b^2))^2 * (q^2 - (a^2/p_2^2))^-0.5
-4 * q^2 * (q^2 - (a^2/b^2))^0.5) * cosh((q^2 - (a^2/p_1^2))^0.5) * h
+ (r_1/r_2) * (q^2 - (a^2/p_1^2))^-0.5 * sinh((q^2 - (a^2/p_1^2))^0.5) * h
and q is unknown. I tried the following to solve F,
b = 2800;
a = 0.2 * 2 * pi;
p_1 = 1400;
p_2 = sqrt(3*b);
r_1 = 100000;
r_2 = 250000;
m = 1;
d = 100;
h = 4000;
F=@(q)(b/a)^4 * ((2*q^2 - (a^2/b^2))^2 * (q^2 - (a^2/p_2^2))^-0.5 ...
-4 * q^2 * (q^2 - (a^2/b^2))^0.5) * cosh((q^2 - (a^2/p_1^2))^0.5) * h ...
+ (r_1/r_2) * (q^2 - (a^2/p_1^2))^-0.5 * sinh((q^2 - (a^2/p_1^2))^0.5) * h;
z0=[-10 10];
sol=fzero(F,z0); % the solution is in region ??
but it gives an error relating to the region,
Error using fzero (line 274)
The function values at the interval endpoints must differ in sign.
Does anyone know how to deal with such an equation or have an alternative way to plot Cm?
  5 Comments
David
David on 20 May 2016
The goal is to plot Cm. I tried diff(F, q) for the denominator but got an error saying q was undefined so I tried to solve the equation. If there is an easier way to plot Cm that would be good also. The "deep" mystery of d=100 is simply because I cut and paste the code block from my editor which has some other stuff going on not relevant to the question.
Roger Stafford
Roger Stafford on 20 May 2016
If you wish to find the derivative of the function F with respect to q using matlab, rather than doing it by hand, then you need to use the symbolic form of the function where all the variables are properly defined as symbolic. Then to do plotting you need to convert this answer back to numerical quantities again. In any event, it makes absolutely no sense attempting to find roots of an equation F(q) = 0 as a substitute for this procedure.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!