Getting warning while running the attached code!!

4 views (last 30 days)
clear all;
close all;
clc;
syms x
E = 30e3;
s_u= 114;
k_p = 154;
n_p = 0.123;
s_f_p = 169;
e_f_p =1.14;
b = -0.081;
c = -0.67;
N = logspace(0,6); % 2N_f
k_f = 2.22;
s_nom = 50;
s_e_peak = (k_f*s_nom)^2/E
eqn = x*((x/E) + (x/k_p)^(1/n_p)) == 0.4107;
sol = solve(eqn)
Warning: Solutions are parameterized by the symbols: z2. To include parameters and conditions in the solution, specify the 'ReturnConditions'
value as 'true'.

Accepted Answer

Walter Roberson
Walter Roberson on 30 Mar 2022
That is not an error.. but it can be a nuisance.
format long g
syms x
E = 30e3;
s_u= 114;
k_p = 154;
n_p = 0.123;
s_f_p = 169;
e_f_p =1.14;
b = -0.081;
c = -0.67;
N = logspace(0,6); % 2N_f
k_f = 2.22;
s_nom = 50;
s_e_peak = (k_f*s_nom)^2/E
s_e_peak =
0.4107
eqn = x*((x/E) + (x/k_p)^(1/n_p)) == 0.4107;
sol = solve(eqn, 'returnconditions', true)
sol = struct with fields:
x: z2^123 parameters: z2 conditions: 1875*154^(107/123)*z2^1123 + 3044854222373485984*z2^246 - 37515648873863720808864 == 0 & -pi/123 < angle(z2) & angle(z2) <= pi/123
cond1 = children(sol.conditions,1)
cond1 = 
p = sym2poly(lhs(cond1));
z_sols = roots(p);
cond2 = children(sol.conditions,2) & children(sol.conditions,3)
cond2 = 
mask = simplify(subs(cond2, z_sols));
valid_sols = z_sols(logical(mask));
overall_sol = vpa(subs(sol.x, sol.parameters, valid_sols))
overall_sol = 
  1 Comment
MG
MG on 30 Mar 2022
Edited: MG on 30 Mar 2022
Thats a warning. My bad. btw thank you so much.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!