Effacer les filtres
Effacer les filtres

Getting warning while running the attached code!!

3 vues (au cours des 30 derniers jours)
MG
MG le 30 Mar 2022
Modifié(e) : MG le 30 Mar 2022
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'.

Réponse acceptée

Walter Roberson
Walter Roberson le 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 commentaire
MG
MG le 30 Mar 2022
Modifié(e) : MG le 30 Mar 2022
Thats a warning. My bad. btw thank you so much.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by