How to create a 100x1 vector variable called b such that the vector b is equal to -5
1 view (last 30 days)
Show older comments
Create a 100x1 vector variable called b such that the vector b is equal to -5
3 Comments
Walter Roberson
on 1 Sep 2016
Use the \ operator. For example,
A = rand(5,8);
b = -5 * ones(5, 1);
A\b
Answers (1)
Walter Roberson
on 31 Aug 2016
One approach:
b = zeros(100,1);
b(:) = -5;
Another approach:
b(1:100,1) = -5;
Another approach:
b = -5 * ones(100,1);
0 Comments
See Also
Categories
Find more on Creating and Concatenating Matrices 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!