Question

I have x=[1 ; 2 ; 4 ; 5 ; 7 ; 9 ; 3] can you write matlab code of column array that calculate mid...

I have x=[1 ; 2 ; 4 ; 5 ; 7 ; 9 ; 3]

can you write matlab code of column array that calculate midpoint between every two points. eg [(1+2)/2; (2+4)/2;(4+5)/2;(5+7)/2...]

answer should give x_midpoint=[1.5 ; 3 ; 4.5 ; .....]

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1-clear all: x-[1; 24;5 7:93] i-length (x) 4一 曰 for(j-1:length (x)-1) x-midpoint (j,-(x(j)+x (j+1))/2; end for (j-length (x))Columns 1 through 4 1.5000 3.0000 4.5000 6.0000 Columns 5 through 7 8.0000 6.0000 2.0000

Add a comment
Know the answer?
Add Answer to:
I have x=[1 ; 2 ; 4 ; 5 ; 7 ; 9 ; 3] can you write matlab code of column array that calculate mid...
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! Use Matlab to calculate array X and array Y. The first column is time (1,...

    Matlab! Use Matlab to calculate array X and array Y. The first column is time (1, 2, 3 ...), and the second column is value (0 and 1). When the value of array X is 0, the value of array Y is itself at the same time. When the value of array X is 1, the value of array Y will become the value of the previous Y(i-1) The data of the array is given, just how to change the...

  • In Matlab A= 3 -5 6 ( 15 7 9 13 5 -4 12 10 2...

    In Matlab A= 3 -5 6 ( 15 7 9 13 5 -4 12 10 2 8 11 4 1 For the matrix A in problem-2, use MATLAB to carry out the following instructions a. Find the maximum and minimum values in each column. b. Find the maximum and minimum values in each row. c. Sort each column in ascending order and store the result in an array P. d. Sort each row in descending order and store the result...

  • matlab help Write a script to manipulate the array A = [2 1 4 3 6...

    matlab help Write a script to manipulate the array A = [2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19] to be in descending order without using the sort function. You must do everything using array manipulation in MATLAB (i.e. you cannot sort it by hand and then hardcode it, you cannot simply create the array 1:20, you cannot simply add .rej3mat(J-l 1],1,10) to A). Write a script that...

  • 2. Given the array A = [2 4 1; 6 7 2; 3 5 9]. Provide...

    2. Given the array A = [2 4 1; 6 7 2; 3 5 9]. Provide appropriate the Matlab commands needed to a. calculate the determinant of A b. show the transpose of A c. Calculate the trace of A d. compute the sum over all rows of A

  • In Matlab Consider the array A. 10 3 5 -4 12 -5 9 2 A= 6...

    In Matlab Consider the array A. 10 3 5 -4 12 -5 9 2 A= 6 13 -8 11 115 -5 4 1 Write a program that computes the array B by computing the square of all the elements of A whose value is greater than 10 and multiplying 5 to each element that is less than or equal to 10. You need to use a logical array as a mask.

  • Write Matlab Determine the constant of array A after the following statement are executed A=[4 7...

    Write Matlab Determine the constant of array A after the following statement are executed A=[4 7 3; 9 12 6; 7 6 9] i. A([1,3],:)=A([2],:) ii. C=eye(3,3) b=[1 2 3] C(2,:)=b

  • MATLAB question I need the code exactly as you would write it in MATLAB. thank you...

    MATLAB question I need the code exactly as you would write it in MATLAB. thank you 1. Consider a Gaussian solution of the traveling-wave form ψ(z,t)-exp(-a(z-vt)2). The parameter values are a 1, 2. (a) Explain the physical meaning of these parameters (eg. what would happen if we took a = 10 instead?) Determine the direction of propagation of this solution: Is it traweling to the left or to the right? (2pts) (b) Write a Matlab code to plot the Gaussian...

  • can you answer both #1 (a&B) and #2 please 1. Write MATLAB code to do the...

    can you answer both #1 (a&B) and #2 please 1. Write MATLAB code to do the following: (4 pts) a) Find the area of the circles where r=[7, 8, 10] using A = tr2 b) Find the distance traveled by a ball falling in the air is given by the equation x=x0+vot+ at?. Calculate the position of the ball at time t = 5s, XO = 10m, vo= 15 m/s, and a = 9.81 m/sec^2. Write MATLAB code to accomplish...

  • Construct a three-column array where column 1 is rnorm(100,2,2), column 2 is rnorm(100, 4, 4) and...

    Construct a three-column array where column 1 is rnorm(100,2,2), column 2 is rnorm(100, 4, 4) and column 3 is rnorm(100, 0, 1). Then write the r code to change this array into an array where each column has exactly mean 0 and exactly variance 1.

  • Refer to the following array definition for questions 1 & 2 int numberArray[9)[11] 1. Write a...

    Refer to the following array definition for questions 1 & 2 int numberArray[9)[11] 1. Write a statement that assigns 145 to the first column of the first row of this array. 2. Write a statement that assigns 18 to the last column of the last row of this array. values is a two-dimensional array of floats, with 10 rows and 20 columns. Write code that sums all of the elements in the array and stores the sum in the variable...

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