Why are condition2 condition3 and condition4 not logical?

2 次查看(过去 30 天)
a=0.336;
Ta=9.476;
Te=1.208;
Tw=1.498;
eqh=[0.661;0.619;0.568];
ex=[-1.24;-1.346;-1.441];
en=-ex;
ey=[0.376;0.705;0.968];
eqx=[-0.309;-0.357;-0.392];
eh=[1.594;1.583;1.545];
eyqh=[0.642;0.78;0.897];
a0=a*Ta*Te^2;
r = -100:1:100;
[bt,Td]=meshgrid(r);
i=1;
figure('Name','Stable');
Kp=1./bt;
exqh(i)=en(i).*eqh(i)+eqx(i).*eh(i);
Ki=1./(bt.*Td);
a1=Ta.*Tw.*eqh(i)+a.*Te^2.*en(i)+a.*Te^2.*ey(i).*Kp;
a2=a.*Te^2.*Ki*ey(i)+Ta+Tw.*exqh(i)-eyqh(i).*Kp.*Tw;
a3=en(i)+ey(i).*Kp-eyqh(i).*Ki.*Tw;
a4=ey(i).*Ki;
condition1 =a1>0; output = ones(length(r));condition2=zeros(size(condition1));condition3=zeros(size(condition1));condition4=zeros(size(condition1));
for j=1:numel(a1)
condition2(j)=det([a1(j) a0;a3(j) a2(j)])>0;
condition3(j) =det([a1(j) a0 0;a3(j) a2(j) a1(j);0 a4(j) a3(j)])>0;
condition4(j)=det([a1(j) a0 0 0;a3(j) a2(j) a1(j) a0;0 a4(j) a3(j) a2(j);0 0 0 a4(j)])>0;
end
output(~(condition1 & condition2 & condition3 & condition4)) = 0;
imshow(output, 'xdata', r, 'ydata', r);
axis on;
Why are condition2 condition3 and condition4 not logical?

采纳的回答

Image Analyst
Image Analyst 2019-7-22
You defined them to be doubles by instantiating them with the zeros() function. Try using false() instead of zeros():
condition2 = false(size(condition1));
condition3 = false(size(condition1));
condition4 = false(size(condition1));

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by