boucle for with two variables

6 ビュー (過去 30 日間)
mondher abidi
mondher abidi 2020 年 7 月 20 日
コメント済み: Star Strider 2020 年 7 月 21 日
Hello
I'm new in matlab and I need help.
i have two variables, the first is called x = [0.45:0.001:0.625] and the second is called y=[0:1200]
i want to multiply the first by the second whatever the step and assign it in another variable called m for plotting.
can you help me plz

採用された回答

Star Strider
Star Strider 2020 年 7 月 20 日
They are (1x176) and (1x1201) respectively, so the only way to multiply them is to create a matrix:
x = [0.45:0.001:0.625];
y = [0:1200];
m = x(:)*y;
The plot is then:
figure
plot(m)
grid
Transposing ‘m’ in the plot call is also an option.
  2 件のコメント
mondher abidi
mondher abidi 2020 年 7 月 21 日
Hello
Thank you for your impressive response.
Star Strider
Star Strider 2020 年 7 月 21 日
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by