How to save for loop output to column vector
5 ビュー (過去 30 日間)
古いコメントを表示
I create a for loop and want the output to be saved in a column vector, so that each output forms a consecutive row of the vector, but I am not sure how to do this. Here is what I have so far:
% just creating the variables
fvf= 2888.7
ccm = 3*10^8*100
h = 6.63*10^-34
v1 = ccm*fvf
invAvkg = 1/(6.022*10^23)/1000
u1 = 35/36*invAvkg
k = 4 * u1 * (v1^2) * pi^2
r1 = 127.5*10^-12
I1 = u1 * r1^2
B1 = hbar^2/2/I1
for JR = [0:3]
delER = (h*v1 + 2*(JR+1)*B1)/h/ccm
end
for JP = [1:3]
delEP = (h*v1 - 2*JP*B1)/h/ccm
end
0 件のコメント
採用された回答
David Hill
2021 年 10 月 11 日
No loops needed, although you never defined hbar.
fvf= 2888.7;
ccm = 3*10^8*100;
h = 6.63*10^-34;
v1 = ccm*fvf;
invAvkg = 1/(6.022*10^23)/1000;
u1 = 35/36*invAvkg;
k = 4 * u1 * (v1^2) * pi^2;
r1 = 127.5*10^-12;
I1 = u1 * r1^2;
B1 = hbar^2/2/I1;
JR = 0:3;
delER = (h*v1 + 2*(JR+1)*B1)/h/ccm;
JP = 1:3;
delEP = (h*v1 - 2*JP*B1)/h/ccm;
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!