How can i store the values for each of the 10 iterations of N. i want to store each and every value of the loop.

2 ビュー (過去 30 日間)
L=2;
element=10;
lambda=1.3;
l=lambda/2;
X3=[-7.655; 6.534];
Y3=[1.393;-7.03];
p=0;
%% loop for the elements of irs
for N=100:100:1000
nn=N;
x_e = zeros(element,N/10,L,N);
y_e = zeros(element,N/10,L,N);
for i=1:L
for j=1:element
for k=1:(nn)/(10)
x3(j,k,i) = X3(i,1) + p; % X coordinate of an element of IRS for plotting
y3(j,k,i) = Y3(i,1); % Y coordinate of an element of IRS for plotting
p=k*l;
x_e(j,k,i,nn) = x3(j,k,i);
y_e(j,k,i,nn)= y3(j,k,i);
end
p=0;
Y3(i,1) = Y3(i,1) + l;
end
% plot(x3,y3,'bo','HandleVisibility','off')
end
end

採用された回答

KSSV
KSSV 2022 年 1 月 27 日
編集済み: KSSV 2022 年 1 月 27 日
Note: You have to initialize the arrays x3, y3
L=2;
element=10;
lambda=1.3;
l=lambda/2;
X3=[-7.655; 6.534];
Y3=[1.393;-7.03];
p=0;
%% loop for the elements of irs
N=100:100:1000 ;
NN = length(N) ;
x_e = zeros(element,NN/10,L,NN);
y_e = zeros(element,NN/10,L,NN);
for n = 1:length(N)
nn=N(n);
for i=1:L
for j=1:element
for k=1:(nn)/(10)
x3(j,k,i) = X3(i,1) + p; % X coordinate of an element of IRS for plotting
y3(j,k,i) = Y3(i,1); % Y coordinate of an element of IRS for plotting
p=k*l;
x_e(j,k,i,n) = x3(j,k,i); % <-- edited here
y_e(j,k,i,n)= y3(j,k,i); % <-- edited here
end
p=0;
Y3(i,1) = Y3(i,1) + l;
end
% plot(x3,y3,'bo','HandleVisibility','off')
end
end
  7 件のコメント
KSSV
KSSV 2022 年 1 月 27 日
Hey there was a typo error in the code. Now I have edited it, Check the code now.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by