Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In matlab: 2. a) Create an anonymous function named quartic that acts as the polynomial quartic(x)=x4+x37x2x+6 This equation has four roots, which are all integers

In matlab:
image text in transcribed
2. a) Create an anonymous function named "quartic" that acts as the polynomial quartic(x)=x4+x37x2x+6 This equation has four roots, which are all integers between 5 and 5 . b) Create a 14 array of zeros names "roots." Write a for loop that tests each integer from 5 to 5 and stores the four values for which quartic returns 0 in the "roots" array. Display roots in the command window. (Hint: you may want to initialize a variable outside of your loop to count how many roots have been found) 3. Generate a random integer ' n ' between 3 and 6 . Create an nn array named "numbers" consisting of random integers between 1 and 50 , and let the array show in the command window (do not suppress this output). Using a while loop, for loop(s), and if statement(s), write code that rearranges the integers in the array so that when read from left-to-right then top-to-bottom all of the even numbers come before all of the odd numbers (with the even numbers in the same order as they started, and the odd numbers in the same order as they started). Output the final sorted array to the command window

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

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago