Question

Using Matlab please answer problem 1, parts a and b. Please explain each for part a....

Using Matlab please answer problem 1, parts a and b. Please explain each for part a. Please explain the result for part b.

1. MATLAB ARRAY INDEXING

(a) Explain what the each of the following will produce:

jk1 = 2:4:17

      jk1 = 99:-1:88

ttt = 2:(1/9):4

(b) Extract or insert numbers in a vector. Try the following:

xx= [ ones(1,4), [2:2:11], zeros(1,3) ]

xx(3:7)

length(xx)

Explain the result.

Homework Answers

Answer #1

jk1 = 2:4:17 creates a vector starting from 2 ending with 17 with step size 4

2    6   10   14

jk1 = 99:-1:88 creates a vector staring from 99 upto 88 by decrementing 1 each time

99   98   97   96   95   94   93   92   91   90   89   88
ttt = 2:(1/9):4 creates a vector from 2 to 4 with step size 1/9
ttt =

 Columns 1 through 8:

    2.0000    2.1111    2.2222    2.3333    2.4444    2.5556    2.6667    2.7778

 Columns 9 through 16:

    2.8889    3.0000    3.1111    3.2222    3.3333    3.4444    3.5556    3.6667

 Columns 17 through 19:

    3.7778    3.8889    4.0000

b)

ones(1,4) gives 1 row 4 columns 1s -> 1 1 1 1

[2 2 11] gives 2 4 6 8 10

zeros(1,3) zeros of 1 row and 3 columns -> 0 0 0

appending all these gives xx = [1 1 1 1 2 4 6 8 10 0 0 0]

xx(3:7) gives a vector of elements xx starting from 3 to 7 --> 1 1 2 4 6

length(xx) gives length of xx that is 12

Know the answer?
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
Similar Questions
Using Matlab please answer problem 1, part a . Please explain for part a. 1. MATLAB...
Using Matlab please answer problem 1, part a . Please explain for part a. 1. MATLAB Script Files (a) Experiment with vectors in MATLAB. Try the following: iset = -3 :11; iset cos( pi*iset/4) Explain how the last example computes the different values of cosine without a loop.
using matlab please present code for the following (ALL PARTS PLEASE AND THANK YOU) 1. No...
using matlab please present code for the following (ALL PARTS PLEASE AND THANK YOU) 1. No Input/No Output Write a function that has no input and no outputs. This function will simply display some text when it is called. (this is my code, are there suggestions for improvements?) function Display() disp('some text') end 2. 1 Input/No Outputs Write a function with one input and no outputs. This function will simply display a variable that is provided as an input argument....
Analog Signal Processing & Filter Design Please answser problem 1 below for parts a, b, c,...
Analog Signal Processing & Filter Design Please answser problem 1 below for parts a, b, c, and d. Please show all work written out, and matlab code for checking the problems with matlab. 1. Find the roots of the following polynomials and write them in factored form:             a. s2 + 4s + 4 (Use the quadratic equation and check with Matlab)             b. s2 + 2s + 10 (Use the quadratic equation and check with Matlab)             c. s3...
This is the code I am working on for a project using MATLAB: clc,clear G=27.7*10.^9; b=0.286*10.^-9;...
This is the code I am working on for a project using MATLAB: clc,clear G=27.7*10.^9; b=0.286*10.^-9; v=0.334; x=(-5*10.^-9:0.1:5*10.^-9); y=(-5*10.^-9:0.1:-1*10.^-9); [xx,yy]=meshgrid(x,y); stress=(-G*b)*yy*(3^xx+yy^2)/(2*pi.*(1-v))*(xx^2+yy^2).^2; figure mesh(xx,yy,stress); grid on xlabel('X') ylabel('Y') zlabel('Stress') Whenever I try to run this I keep getting the "Error using mesh" line, and then an error for "mesh(xx,yy,stress)". I know I am not catching the issue but how do I fix this? If you could explain as well that be extremely helpful!
Part I Please TYPE out EACH answer Using two or more complete sentences, describe how you...
Part I Please TYPE out EACH answer Using two or more complete sentences, describe how you can find a vector parallel to . A boat is traveling with a velocity measured in meters per second, is described by the vector . In two or more complete sentences explain how to find the speed of the boat and the direction it is traveling in standard position.Include all of your calculations in A boat’s velocity, measured in meters per second, is described...
The following question has to be implemented using matlab programming and fdatool a. Extract samples of...
The following question has to be implemented using matlab programming and fdatool a. Extract samples of a music file of a suitable format (sample.mp3, made available on the moodle) providing a duration of 2 seconds playtime, add a colored noise centered around 4.5kHz to the extracted samples so that the SNR is -15 dB. b. Realize an FIR (hamming) and IIR lowpass filter of order 10 having a cutoff frequency of 3kHz respectively. (Obtain the sampling frequency value from the...
Organic Chemistry 1. Please explain how the answer was found. Will rate, thank you very much....
Organic Chemistry 1. Please explain how the answer was found. Will rate, thank you very much. 2.) Draw structures corresponding to the following names: (4E)-2,4-dimethyl-1,4-hexadiene (R)-3-chloro-1-pentene
This problem has 4 parts. This is part 1 of 4. A random sample of 724...
This problem has 4 parts. This is part 1 of 4. A random sample of 724 COVID-19 patients in the U.S. aged 20-44 had a hospitalization rate of 17.7%. Construct a 99% confidence interval for the population proportion of U.S. COVID-19 patients in this age group who require hospitalization. (Complete all calculations in Excel. Type your final interval below by giving the lower endpoint and upper endpoint. Give your answers as decimals, not percents. Round each endpoint to 4 decimal...
find the derivative of each of the following show all work and circle answer please part...
find the derivative of each of the following show all work and circle answer please part 1) f(x)= x+2/x^2+2 part 2) f(x)=2tan(x)+sin(3x)-10 part 3) f(x)=x^2 . cos(x^3-2) part 4) f(x)=ln((x^7 sqrt(x^3+1)/(3x^2+8)^5))
please show all work and circle answer if you cant do all the parts please don't...
please show all work and circle answer if you cant do all the parts please don't answer question part 1) Let g(x,y)=cos(8x+5y). Evaluate g(1,−2). Answer: g(1,−2)= part 2) Suppose f(x,y)=xy^2−8. Compute the following values: f(4,3) = f(3,4) = f(0,0) = f(−1,3) = f(t,2t) = f(uv,u−v) = part 3) Consider the concentration, C, (in mg/liter) of a drug in the blood as a function of the amount of drug given, x, and the time since injection, t. For 0≤x≤6 mg and...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT