Getting warning while running the attached code!!

조회 수: 2(최근 30일)
MG
MG 2022년 3월 30일
편집: MG 2022년 3월 30일
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'.

채택된 답변

Walter Roberson
Walter Roberson 2022년 3월 30일
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
MG
MG 2022년 3월 30일
Thats a warning. My bad. btw thank you so much.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by