Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Tn this Question https://www.chegg.com/homework-help/questions-and-answers/1-smoothing-filter-smoothing-filter-averages-rapid-changes-data-set-typically-used-remove--q30368992 when u run function function smoothed=CTask2p1_f(x,width) smoothed=zeros(size(x)); if rem(width,2)==0 width=width+1; disp('width is even. Converting to odd by incrementing by 1') end

Tn this Question

https://www.chegg.com/homework-help/questions-and-answers/1-smoothing-filter-smoothing-filter-averages-rapid-changes-data-set-typically-used-remove--q30368992

when u run function

function smoothed=CTask2p1_f(x,width) smoothed=zeros(size(x)); if rem(width,2)==0 width=width+1; disp('width is even. Converting to odd by incrementing by 1') end f1 = conv(x,ones(1,width),'same')/width; smoothed(width-fix(width/2):length(x)-fix(width/2))=f1(width-fix(width/2):length(x)-fix(width/2)); for n = 1:(width-fix(width/2))-1 smoothed(n)= mean([x(1:n-1),x(n:n+n-1)]); end for n=(width-fix(width/2))-1:-1:1 j=length(x)-n+1; w=length(x)-j; smoothed(j)=mean([x(j),x(j-w:j-1),x(j+1:length(x))]); end

it gives this error:

Index exceeds matrix dimensions.

Error in CTask2p1_f (line 10) smoothed(n)= mean([x(1:n-1),x(n:n+n-1)]);

how to solve it

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions