I want to get the values of a,b,c,d when T =1 as an example

1 view (last 30 days)
This is the code for explanation
clc
clear all
a= 24:1:26;
b= 24:1:26;
c=24:1:26;
d=24:1:26;
m=length(a)
n=length(b)
f=length(c)
k=length(d)
for i=1:m;
for j= 1:n;
for l=1:f;
for o=1:k;
T(i,j,l,o)= (a(i)*b(j))/(c(l)*d(o))
end
end
end
end

Accepted Answer

KSSV
KSSV on 16 Jun 2022
a= 24:1:26;
b= 24:1:26;
c=24:1:26;
d=24:1:26;
[a,b,c,d] = ndgrid(a,b,c,d) ;
a = a(:) ; b = b(:) ; c = c(:) ; d = d(:) ;
T = (a.*b)./(c.*d) ;
idx = T==1 ;
iwant = [a(idx) b(idx) c(idx) d(idx)] ;

More Answers (1)

l l
l l on 16 Jun 2022
a= 24:1:26;
b= 24:1:26;
c=24:1:26;
d=24:1:26;
m=length(a);
n=length(b);
f=length(c);
k=length(d);
for i=1:m;
for j= 1:n;
for l=1:f;
for o=1:k;
T1= (a(i)*b(j))/(c(l)*d(o));
T(i,j,l,o)=T1;
if T1==1
sprintf('a=%f,b=%f,c=%f,d=%f\n',a,b,c,d)
end
end
end
end
end

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!