Question

MATLAB This is a copy and paste of what we need to do. Enter this in...

MATLAB

This is a copy and paste of what we need to do. Enter this in MATLAB. Please explain what you are doing and why. I don't just want the answer. I want to study this. This is a 100 class and the teacher teaches it as if we are 300 students....

please help me learn not just get the answer

% q11_sol.m % % Quiz #11 solutions % February 11, 2020 % %% Part 1 % For the given vector % V = [ 6 1 7 4 9 5 8 3 10 2 ] % Create vector V1 by dividing % all even members with 2. % What is the sum of V1? v=[6 1 7 4 9 5 8 3 10 2]; % create vector % initialize new vector v1=v; % select only even elements sel=2:2:length(v); % from 2, every other, until the end of the vector % divide even members by 2 % you can use for loop or select only even elements v1(sel)=v1(sel)/2; % divide only selected elements sum(v1) % ans = % % 47.5000 %% Part 2 % load vector x load rsig.mat % MAT file with original signal % initialize variables N=length(x); % length of the vector with samples % Processing - find maximums dp=[0 diff(x)]; % differences % find maximums j=0; % index of array of results for i=2:N % for each sample % (start from the second since we find differences and index must be >0) if (dp(i-1)>0) & (dp(i)<0) % did I find local maximum? j=j+1; % update my result index it(j)=i-1; % save index of the previous sample as local maximum end end % I now have all local maximums, their indices are in vector it % and their values are x(it). % How many peaks have amplitude greater than 0.55? sum(x(it)>0.55) % ans = % % 52

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

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

PART 1

V = [ 6 1 7 4 9 5 8 3 10 2 ]; define a vector V given by your prof

V1=V; Basically assigns the same vector to another variable named v1

sel=2:2:length(V); it is basically consisting of all elements from 2 to length of V with 2 spacing. So, for example it will be [2,4,6,8,10] if the length is 10 or 11

V1(sel) basically fetches all elements from V1 which have index in sel So, for example

V1([2,4,6,8,10]) will have elements at index2,4,6,8,10 in V1

So,

V1(sel)=V1(sel)/2 means that divide all elements at that index by 2 which means at even index

Now V1 is edited according to output needed

Note: Brother According to Chegg's policy we are only allowed to answer first part if there are many. So, I request you to post other part as separate posts.

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
MATLAB This is a copy and paste of what we need to do. Enter this in...
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
  • Note: I need matlab code and it must be on first entry, output what the question...

    Note: I need matlab code and it must be on first entry, output what the question needs and i need it without any false in the matlab pls program logic: • Find the index of minimum element with min() function. Make sure to take two outputs while using min(), the second output is the location of the minimum element. • replace the element at minimum index with mean(v) • find sum(v) and assign it to output program: function x =...

  • Using java fix the code I implemented so that it passes the JUnit Tests. MATRIX3 public...

    Using java fix the code I implemented so that it passes the JUnit Tests. MATRIX3 public class Matrix3 { private double[][] matrix; /** * Creates a 3x3 matrix from an 2D array * @param v array containing 3 components of the desired vector */ public Matrix3(double[][] array) { this.matrix = array; } /** * Clones an existing matrix * @param old an existing Matrix3 object */ public Matrix3(Matrix3 old) { matrix = new double[old.matrix.length][]; for(int i = 0; i <...

  • using this array I need to create a user created function in Matlab that does the...

    using this array I need to create a user created function in Matlab that does the following I have this so far but I'm so lost could you please make this with comments on what the codes do Lure dueren suuj (COM 94 97 95 19 91 88 95 87 90 72 78 60 98 87 81 79 76 69 192 80 77 73 78 70 80 89 81 186 94 901 b. Find the lowest grade in Math subject...

  • MATLAB Define the following computer programming terms and give an example of each. MATLAB example Sequence...

    MATLAB Define the following computer programming terms and give an example of each. MATLAB example Sequence Selection structure- Repetition structure - Relational operators (True = 1, False = 0) Logical operators (True = 1, False =0) And Or Less than Less than or equal to Greater than Greater than or equal to Equal to Not equal to Not ans ans Type the following relational operator commands into MATLAB in the command window one at a time. Write the results to...

  • Compute the following problems using Math Lab.   Instructions: Answer All Questions using MATLAB commands. Question 1....

    Compute the following problems using Math Lab.   Instructions: Answer All Questions using MATLAB commands. Question 1. Create a vector of the even whole numbers between 31 and 75. Question 2. Let x [2516] a. Add 16 to each element b. Add 3 to just the odd-index elcments c. Compute the square root of each element d. Compute the square of each element Question 3. Let x 13 268T and y [4 1 3 5] (NB. x and y should be...

  • Hi there. I tried to submit this before, but the copy/paste didn't copy my vectors correctly....

    Hi there. I tried to submit this before, but the copy/paste didn't copy my vectors correctly. Hello there. I am trying to implement the djikstras shortest path algorithm into my code in C++ with a vector of vectors. However, when I test I get an error "Exception thrown at 0x75FFC762 in graphMain.exe: Microsoft C++ exception: std::out_of_range at memory location 0x009CF26C" for line 115 in graph.cpp. Could you help me debug? I am so close! ----------------------------FILE NAME: pch.h--------------------------------------- // pch.cpp: source...

  • USING MATLAB: Please show how to do this in Matlab a) Create a script file that...

    USING MATLAB: Please show how to do this in Matlab a) Create a script file that uses three sets of nested loops to calculate the final temperature of a light bulb filament. The three nested loops are necessary to calculate Tf for all possible combinations of P, A, and Ti for the engineering formula below. The output from the script should be a 1xn vector representing the values of Tf. You must initialize the output variable so it does not...

  • Linear algebra: tell me what happen. How do we get that matrix A by using the...

    Linear algebra: tell me what happen. How do we get that matrix A by using the D derivative D(x^2)=2x how we get D(x^2)=2x+0*1???? follow the comment EXAMPLE 5 The linear transformation D defined by D(p-p' maps P3 into P2. Given the ordered bases [r.x, and [x, for Ps and P2, respectively, we wish to determine a matrix representation for D. To do this, we apply D to each of the basis elements of P3 Convert t Microso Documen D(x) =...

  • MATLAB MATLAB MATLAB Consider the diagram below V R$ Here, each V represents a change in...

    MATLAB MATLAB MATLAB Consider the diagram below V R$ Here, each V represents a change in voltage (in volts) at a battery, each R represents a resistance in ohms) at a resistor and each I represents a current (in amps) through a wire. These quantities obey two simple laws: 1. Ohm's law: The voltage drop across a resistor is V = IR. 2. Kirchhoff's second law: The sum of all the voltage changes in a closed loop is zero. Using...

  • help me please , By using MATLAB How can I plot the solution of linear diffrential...

    help me please , By using MATLAB How can I plot the solution of linear diffrential system ? I want the code in general case We were unable to transcribe this imageclose all clear MATLAB Code: clc A= [1 0 1; 0 0 0;00-1]; % Coefficient Matrix Xo = [5 76]'; % Initial condition V, D = eig(A); % Get the Eigen values and Eigen vectors % General Solution: X=Sum of {c_i*exp(L_i*t) *V_i % where c_i are constants, L_i are...

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