Can anyone please help me ? I am not able to find the a value y from x

1 view (last 30 days)
Devesh Kumar
Devesh Kumar on 22 Jun 2022
Commented: Devesh Kumar on 22 Jun 2022
for i=1:cf_n
if x1(i,1)<Vrd_cf(i) && x1(i,2)>Vrd_cf(i)
index2(i) = find((abs(xa(i,:)-Vrd_cf(i)) < 0.001),1,"last");
Y_point2(i) = ya(index2(i));
AZ_L(i) = Y_point2(i);
elseif x1(i,2)<Vrd_cf(i) && x1(i,3)>Vrd_cf(i)
index2(i) = find((abs(xb(i,:)-Vrd_cf(i)) < 0.001),1,"last");
Y_point2(i,:) = yb(index2(i));
AZ_L(i) = Y_point2(i);
elseif x1(i,3)<Vrd_cf(i) && x1(i,3)>Vrd_cf(i)
index2(i) = find((abs(xc(i,:)-Vrd_cf(i)) < 0.001),1,"last");
Y_point2(i,:) = yc(index(i));
AZ_L(i) = Y_point2(i);
elseif x1(i,4)<Vrd_cf(i) && x1(i,4)>Vrd_cf(i)
index2(i) = find((abs(xd(i,:)-Vrd_cf(i)) < 0.001),1,"last");
Y_point2(i,:) = yd(index(i));
AZ_L(i) = Y_point2(i);
elseif x1(i,1)>Vrd_cf(i)
AZ_L(i) = 0;
else
AZ_L(i) = 0;
end
end
Here In this code , xa,xb, xc are different equations and these equations is a matrix of 3 rows and 1000 columns
let me take "xa" only , I am just taking an example
xa = [ 1 2 3 .....................; 0.1 0.2 0.3 .....................; .001 .002 .003 .........................]
based on these condition and for loops
i have to get AZ_L which will be [A1;A2:A3], i.e., 3*1 matrix
problems which i am facing is ,
a. Index should be 3*1 but i am geeting 1*3 (the absoulute values of index is correct but vector is wrong )
b. and due to this all this i am getting is 1*3 , and it should be in 3*1

Accepted Answer

KSSV
KSSV on 22 Jun 2022
Did you initialize AZ_L? If not initialize it as
AZ_L = zeros(3,1) ;
  3 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!