Question
Matlab help Make a vector from 1 to 5 labled a. Then set the variable x=2. Then create a for loop for b=x+a. Basically b
Matlab help
Make a vector from 1 to 5 labled a. Then set the variable x=2. Then create a for loop for b=x+a.
Basically b should output b = 3 6 9 12 15.
I got the right answer in the wrong way by doing
a = 1:1:5
x=2a
b=x+a
but the x=2a is cheating. I'm supposed to make x increase by 2 by each loop but instead I stuck it to a vector. I'm not sure how to make a for loop where the variable is multiplied by the number of loops.
something like x1=x+2((number of loops)-1)
b=x1+a
BTW I rewrote this question in my own words because a bot is giving an unrelated answer to the original wording of the question.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started