简体   繁体   English

如何在Matlab中的'for'循环内创建2D数组

[英]How to create a 2D array inside a 'for' loop in matlab

I am new to matlab and I am trying to calculate ifft transform of vector Y for z=1:100. 我是Matlab的新手,正在尝试为z = 1:100计算向量Y的ifft变换。

Here is the current version of the relevant part of the code (no array): 这是代码相关部分的当前版本(无数组):

for z=1:100
Y=(exp(kx.^2))*(exp(i*z/2*k0)).*PSIX_0;
psix_z=ifft(Y);
end

where: PSIX_0 and kx are both 1x100 arays. 其中:PSIX_0和kx均为1x100。 k0 is a constant. k0是一个常数。

All I can see now is the last row for z=100. 我现在看到的是z = 100的最后一行。 Is there a way to recive a ifft of vector Y for each value of z? 有没有办法为z的每个值获取向量Y的ifft?

Thanks! 谢谢!

How about psix_z(z,:) = ifft(Y); psix_z(z,:) = ifft(Y); ? Or psix_z(:,z) , depending on whether the ifft is a row or column vector. psix_z(:,z) ,取决于ifft是行向量还是列向量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM