Q:

Generate a random integer n, create a vector of the integers 1 through n in steps of 2, square them, and plot the squares

0

 Generate a random integer n, create a vector of the integers 1 through n in steps of 2, square them, and plot the squares. 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Ch3Ex19.m

% Create a vector of integers 1:2:n where n is random

% square them and plot the squares

n = randi([1,50])

vec = 1:2:n;

vecsq = vec .^ 2;

plot(vecsq,'k*')

title('Squares of integers')

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now