How to add two different vectors?

3 ビュー (過去 30 日間)
Jeah MK
Jeah MK 2022 年 1 月 20 日
回答済み: KSSV 2022 年 1 月 20 日
I have a question regarding two vectors dimensions.
x = 0:1:10000;
y = 2*x;
Then I would like to take 10 points from vector x, and re-calculate the vector y. I have a problem with the matrix dimention here.
z = 0.1:0.1:1;
x_n = x + z;
y_n = 2*x_n;

回答 (1 件)

KSSV
KSSV 2022 年 1 月 20 日
x = 0:1:10000;
y = 2*x;
z = linspace(0.1,1,length(x)); % make z same size as x, so use linspace
x_n = x + z;
y_n = 2*x_n;

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by