How to solve "equation with fractional power" using Matlab??

4 views (last 30 days)
Hi all, I had the following code to solve an equation that has fractional power;
syms alpha mio B r
alpha=1;
mio=0.6;
B=2;
if alpha==1
if mio==0.6
if B==2
bast=(r/0.5).^(alpha*(mio-1));
mqam_part1=3*B*((sqrt(3)/2).^(alpha*mio));
mqam_part2=((0.5*sqrt(3)).^(-alpha))+((1.5*sqrt(3)).^(-alpha));
mqam_part3=3*(((r/0.5)).^(alpha*mio));
mqam_part4=((sqrt(3)-(r/0.5)).^-alpha);
mqam_part5=((2*sqrt(3))-(r/0.5)).^-alpha;
mqam_part6=mqam_part4+mqam_part5;
mqam_part7=2*((3-(r/0.5)).^-alpha);
mqam_part8=6*(((r/0.5)).^(alpha*mio));
mqam_part9=6*B*(2.^-alpha);
eqn_LHS=bast/(mqam_part1+mqam_part2)+(mqam_part3*
(mqam_part6+mqam_part7));
eqn_RHS=B/((mqam_part8*mqam_part6)+mqam_part9);
eqn1=eqn_LHS==eqn_RHS;
sol_positive = vpasolve(eqn1,r,[0 Inf]);
end
end
end
But, it does not work. So, How can I solve this equation??
  1 Comment
Image Analyst
Image Analyst on 1 Feb 2020
Original question by erman:
How to solve an equation that has fractional power using matlab??
Hi all, I had the following code to solve an equation that has fractional power;
syms alpha mio B r
alpha=1;
mio=0.6;
B=2;
if alpha==1
if mio==0.6
if B==2
bast=(r/0.5).^(alpha*(mio-1));
mqam_part1=3*B*((sqrt(3)/2).^(alpha*mio));
mqam_part2=((0.5*sqrt(3)).^(-alpha))+((1.5*sqrt(3)).^(-alpha));
mqam_part3=3*(((r/0.5)).^(alpha*mio));
mqam_part4=((sqrt(3)-(r/0.5)).^-alpha);
mqam_part5=((2*sqrt(3))-(r/0.5)).^-alpha;
mqam_part6=mqam_part4+mqam_part5;
mqam_part7=2*((3-(r/0.5)).^-alpha);
mqam_part8=6*(((r/0.5)).^(alpha*mio));
mqam_part9=6*B*(2.^-alpha);
eqn_LHS=bast/(mqam_part1+mqam_part2)+(mqam_part3*
(mqam_part6+mqam_part7));
eqn_RHS=B/((mqam_part8*mqam_part6)+mqam_part9);
eqn1=eqn_LHS==eqn_RHS;
sol_positive = vpasolve(eqn1,r,[0 Inf]);
end
end
end
But, it does not work. So, How can I solve this equation??

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 4 May 2018
You need to use the ellipsis ‘...’ continuation operator in this line:
eqn_LHS=bast/(mqam_part1+mqam_part2)+(mqam_part3* ...
(mqam_part6+mqam_part7));
that will then result in:
sol_positive =
1.1346820568166646985869986274402e225226918

More Answers (0)

Categories

Find more on Function Creation in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!