フィルターのクリア

Hi i'm trying to crate a table colums of table will be col1 col2 col3 col4 and col5. I have to store all iteration steps in a matrix. How can i do that?

3 ビュー (過去 30 日間)
clear;
clc;
syms m ;
h=6.626e-34;
k=1.3807*10^-3;
C2=14388;
C0=2.998e8;
C1=2*pi*h*C0^2;
for nlamdaT=1000:100:50000
eta=C2/nlamdaT;
fun=(6+(6*(eta*m))+(3*((m*eta).^2))+(((m*eta)^3)))/(exp(m*eta)*(m^4));
S=symsum(fun,m,1,inf);
f=(15/pi^4)*S;
% make the columns of table
col1=nlamdaT';
col2=(1/(nlamdaT))*10.^4;
col3=10^24*C1./((nlamdaT).^5.*(exp((C2./nlamdaT))-1));
col4=10^20*C1./((nlamdaT).^3.*(exp((C2./nlamdaT))-1));
col5=double(f);
nlamdaT=nlamdaT+10;
% create the table
T=table(col1,col2,col3,col4,col5)
end

採用された回答

madhan ravi
madhan ravi 2018 年 10 月 23 日
clear; clc; syms m ;
h=6.626e-34;
k=1.3807*10^-3;
C2=14388;
C0=2.998e8;
C1=2*pi*h*C0^2;
ctr=1;
T=table;
for nlamdaT=1000:100:50000
eta=C2/nlamdaT;
fun=(6+(6*(eta*m))+(3*((m*eta).^2))+(((m*eta)^3)))/(exp(m*eta)*(m^4));
S=symsum(fun,m,1,inf); f=(15/pi^4)*S; % make the columns of table
col1(ctr)=nlamdaT';
col2(ctr)=(1/(nlamdaT))*10.^4;
col3(ctr)=10^24*C1./((nlamdaT).^5.*(exp((C2./nlamdaT))-1));
col4(ctr)=10^20*C1./((nlamdaT).^3.*(exp((C2./nlamdaT))-1));
col5(ctr)=double(f);
% T=nlamdaT+10; % NO NEEDED
x=table(col1(ctr),col2(ctr),col3(ctr),col4(ctr),col5(ctr));
T = [T; x];
ctr = ctr+1;
end
T
  5 件のコメント
Peter Perkins
Peter Perkins 2018 年 10 月 31 日
If I am reading this code correctly, take these two lines
x=table(col1(ctr),col2(ctr),col3(ctr),col4(ctr),col5(ctr));
T = [T; x];
Out of the loop, and put this line
T = table(col1,col2,col3,col4,col5);
after the loop.
madhan ravi
madhan ravi 2018 年 10 月 31 日
Thank you! @Perkins its simple :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumeric Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by