Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use matlab to solve 2. Problem-solving using MATLAB program Write a custom function with the declaration: PPTasklp2 f (N) and save it in a file

Use matlab to solve

image text in transcribed

2. Problem-solving using MATLAB program Write a custom function with the declaration: PPTasklp2 f (N) and save it in a file named PPTaskip2 f.m. The function loops through the values from 1 to N and for each number n it should display in the command window: 'n is divisible by 3' (use disp function), n is divisible by 5, 'n is divisible by 3 AND 5', or 'n is NOT divisible by 3 or 5 You must use a for loop, the function rem to figure out if a number is divisible by 3 or 5, and num2str to convert each number to a string for displaying. You can use any combination of if, else, and elseif. Call the function in the command window: PPTasklp2 f (16) and verify if the following information is displayed: >>PPTasklp2_f (16) 1 is NOT divisible by 3 or 5 2 is NOT divisible by 3 or 5 3 is divisible by 3 4 is NOT divisible by 3 or 5 5 is divisible by 5 6 is divisible by 3 7 is NOT divisible by 3 or 5 8 is NOT divisible by 3 or5 9 is divisible by 3 10 is divisible by 5 11 is NOT divisible by 3 or 5 12 is divisible by 3 13 is NOT divisible by 3 or 5 14 is NOT divisible by 3 or 5 15 is divisible by 3 AND5 16 is NOT divisible by 3 or 5

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 Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago