Why are condition2 condition3 and condition4 not logical?

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));

댓글 수: 2

Thanks, I know now.l
Please, can you then "Accept this answer" by clicking on that link on this page? Thanks in advance.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

릴리스

R2018b

태그

질문:

2019년 7월 22일

댓글:

2019년 7월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by