Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have this function IN MATLAB function y = even(x) while x.data(1) == 1 x.data(1) = 0; x.data(1) = []; x.offset = x.offset + 1;

I have this function IN MATLAB

function y = even(x)

while x.data(1) == 1

x.data(1) = 0;

x.data(1) = [];

x.offset = x.offset + 1;

end

end

GIVES ME THIS OUTPUT

>> x = sequence([1 4 3 -2 6], -1);

>> xe = even(x)

xe=

data: [4 3 -2 6]

offset: 0

>> x = sequence([1 4 3 -2 6], -1);

>> xe = even(x)

Output argument "y" (and maybe others) not assigned during call to "even".

THE CORRECT OUTPUT IS:

>> x = sequence([1 4 3 -2 6], -1);

>> xe = even(x)

xe=

data: [3 -1 2 4 2 -1 3]

offset: -3

COULD YOU TELL ME PLEASE WHAT I NEED TO CHANGE IN MY CODE TO GET THE CORRECT OUTPUT

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

Step: 3

blur-text-image

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

6. Team members respect and trust each other.

Answered: 1 week ago

Question

What is cost plus pricing ?

Answered: 1 week ago

Question

1. What are the types of wastes that reach water bodies ?

Answered: 1 week ago

Question

Which type of soil has more ability to absorb water?

Answered: 1 week ago