0×1 empty double column vector

16 views (last 30 days)
My Code -
disp("Break Away Point")
syms sigma omega k f real
s = sigma+j*omega;
fx = (s^3)+(3*s^2)+(2*s)+k;
f = expand(fx);
f1 = real(f);
f2 = imag(f);
A = jacobian([f1,f2],[sigma omega]);
omega = 0;
sigma = vpasolve(det(eval(A)),sigma)
A2 = eval(f1);
k = double(vpasolve(A2,k))
k =
0×1 empty double column vector
any suggestion how to fix it?
  3 Comments
Matt J
Matt J on 14 Feb 2022
There's nothing obviously invalid about the answer. Maybe the solution set is truly empty.
Tenzing Thiley
Tenzing Thiley on 14 Feb 2022
no it is not if I type A(1) it is giving value

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 14 Feb 2022
There are multiple solutions, but your code was trying to find a single k value that satisfied all of the possibilites at the same time.
Also, do not eval() a symbolic expression. eval() of a symbolic expression gives an undefined result.
disp("Break Away Point")
Break Away Point
syms sigma omega k f real
s = sigma+j*omega;
fx = (s^3)+(3*s^2)+(2*s)+k;
f = expand(fx);
f1 = real(f)
f1 = 
f2 = imag(f)
f2 = 
A = jacobian([f1,f2],[sigma omega])
A = 
Omega = 0;
Sigma = solve(det(subs(A, omega, Omega)),sigma)
Sigma = 
A2 = subs(f1, {sigma, omega}, {Sigma, Omega})
A2 = 
k = arrayfun(@(expr) solve(expr,k), A2)
k = 
  40 Comments
Tenzing Thiley
Tenzing Thiley on 27 Feb 2022
Do you know how should I use tiledlayout for multiple graph in one page as in this cases I am getting error
Error using DynamicSystem/rlocus (line 65)
This functionality is not supported in TiledChartLayout
%root locus
tiledlayout(2,2)
nexttile
pitch1 = -pitch/(s+10);
rlocus(pitch1);
v = [-4 4 -4 4]; axis(v)
grid
title('Root-Locus Plot of Pitch displacement Auto pilot]');
xlabel('Real Axis')
ylabel('Imag Axis')
%Bode plot
k = 45;
pitch2 = k*pitch1;
margin(pitch2)
grid on;
title('Bode Plot Pitch of displacement Auto pilot');
tiledlayout(1,2)
sys_cl = feedback(pitch2,1);
step(0.2*sys_cl), grid
ylabel('pitch angle (rad)');
title('Closed-loop Step Response')
Walter Roberson
Walter Roberson on 27 Feb 2022
You could try using subplot() instead of tiled layout. However, some of the plots in that toolbox need a complete figure to draw in, because the plots they draw are interactive plots instead of static plots

Sign in to comment.

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!