How to assign the value of a symbolic varible in a cell to other variable

2 views (last 30 days)
i want to solve the equations for the variable M,
syms M; L = 5.0; A = 1.6; P = 0.0; w = 0.4195; R = 25; PBAR = P/(pi*w*R); e1 = A^3 - L*A^2.*(sqrt(M.^2-1) + M.^2.*acos(1./M)) - PBAR; e2 = L*A^2/2*(sqrt(M^2-1) + (M^2-2)*acos(1/M)) + ... 4*L^2*A/3*(sqrt(M^2-1)*acos(1/M)-M+1)-1; % evalin(symengine, 'numeric::solve(e1, M = 0..2)') solution{1}=feval(symengine, 'numeric::fsolve',e2-e1,'M')
the output is
solution =
M = 1.0138797382340744030864073818239248
how to get the value of M; which is stored in a 1X1sym.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 16 Jan 2014
str2double(regexp(char(solution{1}),'[.\d]+','match'))
  3 Comments
vijay
vijay on 16 Jan 2014
Edited: vijay on 16 Jan 2014
how to use parallel computing for the given code
syms M;
L = 5.0;A = 1.6;P = 0.0; w = 0.4195; R = 25; PBAR = P/(pi*w*R);
e1 = A^3 - L*A^2.*(sqrt(M.^2-1) + M.^2.*acos(1./M)) - PBAR;
e2 = L*A^2/2*(sqrt(M^2-1) + (M^2-2)*acos(1/M)) + 4*L^2*A/3*(sqrt(M^2-1)*acos(1/M)-M+1)-1;
solution{1}=feval(symengine, 'numeric::fsolve',e2-e1,'M')
i tried with
ms.UseParallel = 'always'
but didnt work (out of 4 cores, 2 cores are only loaded & 2 cores are free)

Sign in to comment.

More Answers (0)

Categories

Find more on Deployment, Integration, and Supported Hardware 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!