This is the solution I am trying to mimic, but for my case it does not seem to work:
syms ki kd
cond = [ -9*ki, 10*ki - 10*kd + 10, 360*kd - 24*ki + 1320]; % My 3 inequality conditions
Unrecognized function or variable 'ki'.
r = -5:0.01:5;
[ki, kd] = meshgrid(r);
condition1 = cond(1) > 0;
condition2 = cond(2) > 0;
condition3 = cond(3) > 0;
output = ones(length(r));
output(~(condition1 & condition2 & condition3)) = 0; % this fails
imshow(output, 'xdata', r, 'ydata', r);
axis on;
the line that fails gives me this error:
Error using symengine
Unable to prove '~0 < -9*ki | ~0 < 10*ki - 10*kd + 10 |
~0 < 360*kd - 24*ki + 1320' literally. Use 'isAlways' to
test the statement mathematically.
Error in sym/subsindex (line 841)
X =
find(mupadmex('symobj::logical',A.s,9)) -
1;
How can I solve this? It seems like it should be such a simple thing to do, but I can't make it work.

 Akzeptierte Antwort

KSSV
KSSV am 18 Jun. 2022
Bearbeitet: KSSV am 18 Jun. 2022

1 Stimme

r = -5:0.01:5;
[ki, kd] = meshgrid(r);
cond = -9*ki>0 & 10*ki - 10*kd + 10>0 & 360*kd - 24*ki + 1320>0; % My 3 inequality conditions
% output = ones(length(r));
% output(~(condition1 & condition2 & condition3)) = 0; % this fails
imshow(cond, 'xdata', r, 'ydata', r);
axis on;

3 Kommentare

YLieven
YLieven am 18 Jun. 2022
What if I wanted a surf plot instead of imshow?
I want it to become something like this:
with the "Z" coordinate fixed in a specific value (like -1 in the image above).
KSSV
KSSV am 18 Jun. 2022
Replace zeros with Nan and use surf.
YLieven
YLieven am 18 Jun. 2022
It works! Thank you.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Version

R2019a

Gefragt:

am 18 Jun. 2022

Kommentiert:

am 18 Jun. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by