Why are condition2 condition3 and condition4 not logical?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
zhenyu zeng
el 22 de Jul. de 2019
Comentada: Image Analyst
el 23 de Jul. de 2019
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?
0 comentarios
Respuesta aceptada
Image Analyst
el 22 de Jul. de 2019
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 comentarios
Image Analyst
el 23 de Jul. de 2019
Please, can you then "Accept this answer" by clicking on that link on this page? Thanks in advance.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!