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 value of Y at the corresponding time according to the value of X
Save the new results in a new array

% Sample data for testing Data = [[1:50]' randi([0 1],50,1)]; % Getting X and Y calculated X = Data(:, 2); Y = Data(:, 1); % Setting Y for X = 0 idx_0 = find(X==0); Y(idx_0) = Y(idx_0) % Setting Y for X = 1 idx_1 = find(X==1); Y(idx_1) = Y(idx_1-1)


Note: For queries, drop me a comment.
Matlab! Use Matlab to calculate array X and array Y. The first column is time (1,...
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...
array : .word 300 # Attempt to initialize array lw $15, 8 # num = 8 lw $17, array # Place array in register 17 lw $16, 0 # sum = 0 lw $14, 2 # subtraction value whileLoop: blt $15, $zero exitLoop # $zero always holds the constant 0, while (num >= 0) add $16, $16, $15 # sum += num sub $15, $15, $14 # num -= 2 j whileLoop exitLoop: sw $16, 12($17) # array[3] = sum...
Given the following array of integers (of capacity 20) with 12 items: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 8 4 10 15 5 7 11 3 9 13 1 6 Index of last element = 11 Does this array represent a min heap? If not, convert it to a min heap (i.e., “heapify” it). Please show all steps.
MATLAB
Any guidance is appreciated!
Use meshgrid() function to create 2D grid coordinates with x- and y- coordinates both from -12 to +12 in the increment 1/32. B) Calculate the function z shown below at every (x, y) point and store the result in a 2D array z Z = sin(squareroot x^2 + y^2)/ squareroot x^2 + y^2 c) Find the maximum value in array z and its corresponding index. The array may have more than one maximum points with...
Using Matlab
Background: Work through Matlab Exercise 2 (posted with this assignment). Steps #8 and #9 pertain to this problem. Consider the following sample of ordered pairs (x. y) where y = the purity of oxygen produced in a chemical distillation process, and x the percentage of hydrocarbons that are present in the main condenser of the distillation unit Hydrocarbon Level; x (in %) Purity y (in %) Observation Hydrocarbon Observation Purity Level; x (in %) y (in % )...
Solve using Matlab. Provide actual code.
Create a 1000 x 4 matrix, with the first column switching between 0,1 (starting with 1), and the second column repeating itself in cycles of 1-2-3-4-5, the third column consisting of only 4's and the fourth column repeating itself in cycles of 0-1-2-3
Create a 1000 x 4 matrix, with the first column switching between 0,1 (starting with 1), and the second column repeating itself in cycles of 1-2-3-4-5, the third column consisting of...
Create 4 arrays: a 1-D array to store the students’ id, 1-D array to store the students’ names, a parallel 2-D array to store the test scores, and a parallel 1-D array to store letter grades. Read data into the 3 arrays from the file data121.txt. If the file is not found, the program needs to terminate with this error, “Data file not found.” Calculate and store a letter grade into a 1-D array based on the total score,...
Create 4 arrays: a 1-D array to store the students’ id, 1-D array to store the students’ names, a parallel 2-D array to store the test scores, and a parallel 1-D array to store letter grades. Read data into the 3 arrays from the file data121.txt. If the file is not found, the program needs to terminate with this error, “Data file not found.” Calculate and store a letter grade into a 1-D array based on the total score, sum...
write a Matlab program ( solve the three questions). please use array and create your own function to check primality Question 1 : [10 points) Write a MATLAB program that will store all the first 1000 prime numbers in an array variable named arr_of_primes. Please note that a prime number is a positive integer that is bigger than or equal to 2 which is divisible only by 1 and itself. Examples of the first 8 primes are: 2, 3, 5,...
1. Write a Matlab function to convolve two sequences objects: function y = conv(x, h) % CONV Convolve two finite-length Matlab sequence objects, x and h % returning sequence object, y. When you convolve x[n] and h[n] , you may not use MATLAB's numerical conv routine. 2. write a second convolution function, conv_rt, in Matlab that basically implements a real-time convolu- tion strategy: function y = conv_rt(x, h) % Convolve two finite-length arrays, x and h % returning array, y...