boucle for with two variables

조회 수: 5 (최근 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 CenterFile Exchange에서 Creating, 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