boucle for with two variables

5 views (last 30 days)
mondher abidi
mondher abidi on 20 Jul 2020
Commented: Star Strider on 21 Jul 2020
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

Accepted Answer

Star Strider
Star Strider on 20 Jul 2020
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 Comments
mondher abidi
mondher abidi on 21 Jul 2020
Hello
Thank you for your impressive response.
Star Strider
Star Strider on 21 Jul 2020
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Sign in to comment.

More Answers (0)

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!