store iterative solutions to matrix

1 回表示 (過去 30 日間)
K S Vivek
K S Vivek 2020 年 9 月 23 日
コメント済み: Star Strider 2020 年 9 月 24 日
E=input('\nModulus of Elasticity, E(GPa): ');
L=input('Length of each member, L(m): ');
A=input('Area of c/s, A(m^2): ');
Theta=input('Theta(degree): ');
delta_max=input('Maximum Delta(m): ');
a=sind(Theta);
h=L*a;
delta=0:0.01:delta_max;
del=length(delta);
P_L=zeros(1,del);
for i=1:del
P_L(i)=(2*E*A*10^9*a*a* delta(i))/(L*1000);
end
Need to store all iterative values of P_L as a vector
For E = 70, L=5.41, A=0.0006;delta_max=2; theta=33.69;
Last answer = 9.56 * (10^3)

採用された回答

Star Strider
Star Strider 2020 年 9 月 23 日
Define the range of the independent variables as vectors, then use the ndgrid function to create matrices from them that you can use in the ‘P_L’ assignment (without the indices, since it will be a matrix the same size as the argument matrices) to calculate it from the resulting matrices.
To see the output with respect to each set of variables, use the reshape function on all the argument matrices, and ‘P_L’ to create them each as column vectors. Then use those with the table function to create a table of the results, with appropriate variable names.
There is no way to plot that function against all the independent variables.
  4 件のコメント
K S Vivek
K S Vivek 2020 年 9 月 24 日
Thank you so much for clarifying my doubt and providing the detailed illustration.
Star Strider
Star Strider 2020 年 9 月 24 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by