Linear-spaced points array Construct a row array plotPoints with 5 values that a
ID: 3887945 • Letter: L
Question
Linear-spaced points array Construct a row array plotPoints with 5 values that are spaced linearly from lowValue to highValue. Hint: Use the linspace function Ex: If lowValue is 1 and highValue is 10, plotPoints is [1.0000, 3.2500, 5.5000, 7.7500, 10.0000] Your Function Save Reset MATLAB Documentation function plotPoints CreatePoints (lowValue, highValue) 21% lowalue: Starting value in plotPoints 31% high value: Ending value in p lotPoints s| % construct a row array plotPoints with 5 linear-spaced % point fron Iowa lue to highValue plotPoints- L91end - Code to call your function C Reset 1CreatePoints(1,1) Run Function Assessment Submit Check if CreatePoints(1, 10) returns [1,3.25, 5.5,7.75, 10] Check if CreatePoints(50, 200) returns [50, 87.5, 125, 162.5, 200]Explanation / Answer
CreatePoints.m file
function plotPoints = CreatePoints(lowValue,highValue)
% linspace generates 5 values that are linearly spaced from lowValue to highValue
plotPoints = linspace(lowValue,highValue,5);
end
main.m file
CreatePoints(1,10)
CreatePoints(50,200)
% sample output
%ans =
%
% 1.0000 3.2500 5.5000 7.7500 10.0000
%
%ans =
%
% 50.000 87.500 125.000 162.500 200.000
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.