フィルターのクリア

How to create a matrix array with increments equation using vectorization?

2 ビュー (過去 30 日間)
Teb Keb
Teb Keb 2022 年 2 月 14 日
コメント済み: Teb Keb 2022 年 2 月 14 日
I am trying to create a matrices array after calculating the area and volume of a system with increment equations. Basically the area and volume are changing from 1 to 10 seconds with 1 second increments. Then I have to create a matrix array showing the time with increments row as first column and corresponding calculated area and volume as the second and third column of the matrix using vectorization.
s=0.1;
y=pi;
x=1:1:5;
area=s.*sqrt(y.*x);
vol=s.*y*sqrt(y.*x);
B=[x area vol];
So basically my matrices should be 5x3. But I am confused as to how I can put the rows as increments, I am getting 1x15 matrices.

採用された回答

KSSV
KSSV 2022 年 2 月 14 日
s=0.1;
y=pi;
x=[1:1:5]'; % transpose this
area=s.*sqrt(y.*x);
vol=s.*y*sqrt(y.*x);
B=[x area vol];
size(B)
ans = 1×2
5 3

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by