Question

Linear-spaced points array struct 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 1: function plotPoints-CreatePoints(lowalue, highValue) 21% lowalue: Starting value in plotPoints % highvalue: Ending value in plotPo ints % construct a row array plotPoints with 5 linear-spaced % point from 10«Value to highvalue plotPoints = 0; 9 end C Reset Code to call your function 30 1
0 0
Add a comment Improve this question Transcribed image text
Answer #1

function plotPoints = CreatePoints(lowValue, highValue)
    plotPoints = linspace(lowValue, highValue, 5);
end

\color{blue}\underline{Test\;code:}

CreatePoints(1, 10)

\color{red}\underline{Output:}

ans 1.0000 3.2500 5.5000 7.7500 10.0000

Add a comment
Know the answer?
Add Answer to:
Linear-spaced points array struct a row array plotPoints with 5 values that are spaced linearly from...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • MATLAB Code please! Integer indexing array: Reverse subsets Construct an indexing array indexArray so that the...

    MATLAB Code please! Integer indexing array: Reverse subsets Construct an indexing array indexArray so that the statement reversedOrder origOrder(indexArray); results in a row array beginning at starting index down to element 1 . Ex: If origOrder is 12, 8,9,15, 3, 44, 23, 25,7,68] and startingValue is 3, then reversedOrder is [9, 8,2]. Row array reversedOrder contains origOrder's element 3, element 2, and element 1 Your Function Save Reset E MATLAB Documentation 1 function reversedorder-CopySubset (startingIndex, origorder) 2% start ingindex: starting...

  • Arithmetic array operations Add adjustVal to each element of array originalReadings. Your Functio...

    Arithmetic array operations Add adjustVal to each element of array originalReadings. Your Function Save C Reset MATLAB Documentation 1 function modifiedReadingsCalibrateReadings (originalReadings, adjustVal) 21% origina!Readings: Array of temperature readings 31% adjustval: value added to each element in the array of temperature readings 4. % Add adjustval to each element of array origina!Readings modifiedReadings e 6 7 end Code to call your function C Reset 1 CalibrateReadings([51, 53, 61, 62], 1) Indexing an array element Assign studentScore with the second element...

  • MatLab Help!! Write a function called Difference to calculate the central difference, forward diflerence, and backward diference approximation to an function within a given range of xmin:xinc:xmax...

    MatLab Help!! Write a function called Difference to calculate the central difference, forward diflerence, and backward diference approximation to an function within a given range of xmin:xinc:xmax The input argument of the function Difference is the handle to an anonymous function, a row array xmin:xinc:xmax The differences should be returned as a row array, calculated at xmin xinc xmax Restriction. The function should not use loops Ex func - (x) x.3 xmin-3 xinc-e.25; xmax-4; [backDifference, centralDifference, forwardDifference] Derivative(func, xmin, xmax,...

  • Write a for loop that assigns summed Value with the sum of all odd values from...

    Write a for loop that assigns summed Value with the sum of all odd values from 1 to user Num. Assume userNum is always greater than or equal to 1. Ex: If userNum is 5, then summed Value is 9 (i.e. 1+3+5 =9). Function Save C Reset MATLAB Documentation 1 function summedValue - Oddssum(userNum) summedValue = 0; % Write a for loop that assigns summedValue with the % sum of all odd values from 1 to user Num 7 end...

  • Write a function called ZeroCornersSecondRow that sets the corners of a 2D array to zero and...

    Write a function called ZeroCornersSecondRow that sets the corners of a 2D array to zero and also outputs the second row. The input arguments: • inArray: A double precision 2D array of size nxn, where n is at least 3. The output arguments: outArray: A double precision 2D array of size nxn that is a copy of inArray except with the corners set to zero. • secondRow: A double precision 1D array of size n. This is the second row...

  • ACE331. Plus x A first function. his tool is provided by a third party Though your...

    ACE331. Plus x A first function. his tool is provided by a third party Though your activity may be recorded a page refresh may be needed to fil the banner ACTIVITY Plus x: A first function Assign y with 5 plus x Ex:#xis2. then y is 7. If x is 19, then y is24. Note: Some challenge activities require completing a function (as above), or writing a new function. You can create test calls to the function in he "Code...

  • MATLAB Problem HW7P2 (20 points) (5 pts) Write a user-defined MATLAB function called HW7P2_fn for the...

    MATLAB Problem HW7P2 (20 points) (5 pts) Write a user-defined MATLAB function called HW7P2_fn for the following math function 3 o-0.47x The input to the function is x and the output is y. Write the function such that x can be an array (use element-by-element operations) (15 pts) Use the function in (a) the command window to calculate y(-2) and y(5) (b) a script file HW7P2.m to determine y(x) for 0.001 Sx S 10 with 1000 points. Hint: Use the...

  • Question:Matrix Notation Interpreter (matrix elements to cell array of formatted character vectors) Matlab question Matrix Notation Interpreter (matrix elements to cell array of formatted character...

    Question:Matrix Notation Interpreter (matrix elements to cell array of formatted character vectors) Matlab question Matrix Notation Interpreter (matrix elements to cell array of formatted character vectors) A system of linear algebraic equations can be writen in matrx notation by applying the definizion of matrix multiplication. For example, the linear system Can be writen as or where and x = 2 matrix input ror the variable A and a × T e function command dennes the output variable linearSystem Code has...

  • 2. (10 pts. Please perform the following calculations via MATLAB a. Calculate e3!/pi and round the...

    2. (10 pts. Please perform the following calculations via MATLAB a. Calculate e3!/pi and round the answer to the nearest integer (all via MATLAB commands) b. Calculate cos(wt) for t (time) from 0 seconds to 10 seconds (with 1 second increments – created via colon operator) where w = 30°/seconds c. Please sort the values of the vector given below from smallest to largest and save it as another single column vector and G = [68, 83,61, 70, 75, 82,57,5,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT