Generate a random integer n, create a vector of the integers 1 through n in steps of 2, square them, and plot the squares
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:3| Question number:19.3
All Answers
total answers (1)
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