Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB ONLY Function Name: schrodingersCat Inputs: ( struct ) A MxN structure array ( double ) A 1x2 vector of your starting position Outputs: 1.

MATLAB ONLY

Function Name: schrodingersCat

Inputs:

( struct ) A MxN structure array

( double ) A 1x2 vector of your starting position

Outputs:

1. ( char ) A statement describing the cat, its location, and how many steps it took

Background:

In 1935, Erwin Schro?dinger proposed the famous thought experiment in which cat in a box is simultaneously alive and dead. Only once the box is opened can the cat's state of being be determined. Using your MATLAB skills, you have set up the experiment yourself, and you want to figure out if your cat is alive or dead. However, you set up a large array of many boxes, and forgot which one the cat is in. Good thing you have MATLAB to help you out!

Function Description:

You are given a structure array and a set of indices within the structure array at which to start. Each structure in the array contains only one field, called next . The next field of each structure contains either a 1x2 vector of the indices of the next structure to search or a character vector describing the state of the cat. The character vector describing the cat will either be 'alive cat' or 'dead cat' .

To find the cat, first check the structure at the index given by the second input. Next, check the structure at the indices given in the next field of the previous structure you checked. This process should continue until you encounter the cat, whether it is dead or alive. Be sure to keep a count of how many steps you have gone through before you reach the cat. Your output statement should have the following form:

 'The  was found at position (,) after  steps.' 

Notes:

? The path from the given starting position is guaranteed to reach the cat.

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

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions

Question

Compute the 1-V energy carried by the signal f(t) 5e2.5tu(t).

Answered: 1 week ago

Question

Define an inflation adjusted rate of return and determine its use.

Answered: 1 week ago

Question

design a simple disciplinary and grievance procedure.

Answered: 1 week ago