Question: Help me please I keep getting the variable y wrong , and the submission must contain a title on matlabgrader. Also ,there is an original

Help me please I keep getting the variable y wrong , andthe submission must contain a title on matlabgrader. Also ,there is anoriginal script on the grader. Keep the original script ,and just addHelp me please I keep getting the variable y wrong , and the submission must contain a title on matlabgrader. Also ,there is an original script on the grader. Keep the original script ,and just add the answers to it. For example,don't change line 7 through 9. Just fill up the missing lines with the answers.

below is what I got ,and keep getting the wrong answer on matlab.

%Get input - Load the input noise vector from the file

load('noisydata.mat','x');

%x = rand(1,100); % uncomment to see sample run

%save("noisydata.mat", "x") % uncomment to see sample run

%Find length of x

N=length(x);

% Set the y the same as x vector by copying the x vector to handle the x(1) and x(N), you can also create an empty vector of the same length of x and assing y(1) and y(N)

% But you need to handle the case of length of x is 0 or 1 in a special way to prevent errors.

y(1:N)=x(1:N);

%Do the magic if x is not empty

if ~isempty(x)

%Use a for loop to apply the average filter according to the specification to the array and assign the results to y.

for i = 1:N

if(i==1 | i==N) % if first or last data entry

y(i) = x(i);

else

y(i) = 0.5*(y(i-1)+y(i+1));

end

end

%Draw 2 plots on one window for original noise signal and the smoothed one respectively.

%Generate/get the sample number (index) of the vector x or y

idx = 1:N;

figure(1);

%Plot x vs. idx in subplot 1

%Plot x vs. idx in subplot 1

subplot(2, 1, 1)

xlabel('index')

ylabel('noise')

plot(idx, x)

subplot(2, 1, 2)

xlabel('index')

ylabel('filtered output y')

plot(idx, y)

end

7otdqns pue 70 d do | (u!|un :xeu) pat!uqns suo!nos eu!s as!u e yoous \%plot y vs. idx in subplot 2 end Is for loop used to calculate the result? Is Idx correct? Plotted and annotated the data? The submission must contain the following functions or keywords: title

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!