Write a script to solve the problems using vector operations

Assignment Help MATLAB Programming
Reference no: EM13698105

Question: Write a script to solve the subsequent problems using only vector operations:

a. Assume you have two vectors named A1 and B1 of equal length and create a vector C1 that combines A1 and B1 such that C1 = [A1(1) B1(1) A1(2) B1(2) . . . . A1(end) B1(end)].

For example, if A1 = [2, 4, 8] and B1 = [3, 9, 27], c1 should contain [2, 3, 4, 9, 8, 27]

b. Assume that you have two vectors named A2 and B2 of different lengths. Create a vector C2 that combines A2 and B2 in a manner similar to part a. However, if you run out of elements in one of the vectors, C2 also contains the elements remaining from the longer vector.

For example: if A2 = [1, 2, 3, 4, 5, 6] and B2 = [10, 20, 30], then C2 = [1, 10, 2, 20, 3, 30, 4, 5, 6] if A2 = [1, 2, 3] and B2 = [10, 20, 30, 40, 50], then C2 = [1, 10, 2, 20, 3, 30, 40, 50]

Be sure to include comments. Comments should be included in the program to explain your calculations and program.

 

Reference no: EM13698105

Questions Cloud

2s complement representation : How would you take a decimal number and make it a word-length 2's complement representation?
What is the difference between the behaviors of lband lbu : What is the difference between the behaviors of lband lbu and Give a code fragment that would place the perimeter of the rectangle in r6.
When a process creates a new process using the fork command : When a process creates a new process using the fork command, which of the subsequent is shared between the parent process and the child process?
Signed-magnitude representation of the similar number : Solution the question below, using the ID to identify the number you wish to specify as the correct answer. Place answer in blank provided.
Write a script to solve the problems using vector operations : Write a script to solve the subsequent problems using only vector operations - Assume you have two vectors named A1 and B1 of equal length and create a vector C1 that combines A1 and B1 such that C1 = [A1(1) B1(1) A1(2) B1(2) . . . . A1(end) B1(end..
Reading in strings from a text file into an array : If I am reading in strings from a text file into an array, where do I place this file at so that CodeBlocks will find it?
Describe techniques for optimizing web form usability : Imagine that a local college hired you to look at a lengthy form on the university's office of admissions Website. Prospective students have been calling the office to request information instead of utilizing the university's Website.
Complete set of logic gates : Do 2-input AND gates which have one input inverted form a complete set of logic gates? Rationalize your answer.
What is the output of the following program : What is the output of the following program and please explain it how did you get the answer or the output and the reason. void f(int i ) { if ( i = 4 ll i = 5 )/ Line 1 { cout

Reviews

Write a Review

MATLAB Programming Questions & Answers

  Estimate the numerical wave speed

Scheme and try a couple of values for α, one close to 1 and the other not. Convince yourself that a smaller Δt is not necessarily a better choice.

  Develop a simulation program

Develop a simulation program

  Create functions in file

Create Functions in File and how to code this function - Declare function inputs, and outputs

  Make a program that will graph the parabolas

Make a program that will graph the parabolas each parabola a different color and put all the parabolas in the same figure or graph

  Program the rank order cluster algorithm with a matrix

Program the rank order cluster algorithm with a matrix with x rows and x columns in any plataform (that the person inputs). I prefer visual studio or visual basic

  Develop a well-structured function

Develop a well-structured function to compute v as a function of t. Then use this function to generate a table of v versus t for t = -5 to 50 at increments of 0.5.

  Least squares

For homework consider the points (0,0), (1,2), (2,3), (3,9), ( 4,17), (5,24), (6,37). (1) Use Matlab to find the least squares best fit with a line.  Turn in A, y and c and a plot like the one above.  Also (2) use Matlab to find the least square best..

  Estimation of the rayleigh limit

Propose a method that would allow estimation of the Rayleigh limit experimentally - Rayleigh frequency resolution limit

  Consider a cstr with a feed stream

Consider a CSTR with a feed stream containing only A at a concentration of cA and the reactions A?B?C taking place in the CSTR. Both reactions are first order in the reactant

  Plot with three different shading scheme (one plot per each

create two vectors X and Y of values from (-pi) to pr with a spacing of pi/10. Define the vector Z as: Z=(sin(sqrt(x^2+y^2)))/sqrt(x^2+y^2)

  Calculate and plot the error in the numerical derivative

Write a program to calculate and plot the error in the numerical estimate of the derivative.

  Write a script that will loop through values

Write a script that will loop through values of n until the difference between the approximation and the actual value is less than 0.0001.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd