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
`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.
MATLAB This is a copy and paste of what we need to do. Enter this in...
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 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 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...
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. 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...
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...
Solve in MATLAB
Problem 3: Given the vector x- [2 1 0 6 2 3 5 3 4 1 3 2 10 12 4 2 7 9 2 4 51 use a for loop to (a) Add up the values of all elements in x (b) Compute the cumulative sum, y, of elements in x You can check your results using the built-in functions sum and cumsum. Q.5 What is the value of the sum of elements in vector x?...
I need the real code for this program: (convert pseudocode to C++) ——————————————————— Start Program Type Vector is Structure Defined x is double variable y is double variable End Vector Type Function Prototype Get Choice(parameters: int &) Function Prototype vAddition (parameters: vector v1, vector v2, vector &v3) Function Prototype vSubstract(parameters: vector v1, vector v2, vector &v3) Function Prototype sMult(parameters: int k, vector v, vector &v3) Function Prototype sProduct (parameters: vector v1, vector v2) Function Prototype getMag (parameter: vector v) Function...
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...
## Read directions carefully - USING THE PROGRAMMING LANGUAGE R AND R STUDIO ## Please complete all three problems ## If you exceeded the one line requirement (question 1 and 2) but complete the code successfully, you will only earn half of the points. ## Problem 1. (1 points) ## Using the vector x below, express the Euclidean norm of x. ## Recall that the Euclidean norm of a vector v = <v1, v2, ..., vn> ## is the square...