Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Some one help me with this Matlab program ASAP thank you !! both part a and b with detail Lists of MATLAB functions and commands

image text in transcribedimage text in transcribedimage text in transcribed

Some one help me with this Matlab program ASAP thank you !! both part a and b with detail

Lists of MATLAB functions and commands can be stored in a single file with the exten- sion .m. These files are called M-Files. The commands stored in an M-File can be executed by typing the filename (without the .m extension) at the command prompt. As an example, the M-File expon.m: t--2:0.01:2; y-exp(-abs (t)) plot (t,y) plots the function y(twith t ranging from -2 to 2 in 0.01 increments, when the user types expon at the command prompt. Note, that a file that defines a new function is a special case of an M-File. (a) Create an M-File named Exercise5 that generates and plots two sine waves with frequencies f = 16 Hz and f = 28 Hz. For both sine waves t ranges from 0 to 0.2 in 0.001 increments. Use sinegen to generate the sine waves. Each sine wave should be plotted in a different subplot with appropriate titles and axis labels As in all high level languages MATLAB includes an if - then - else structure that allows a group of commands to be executed when a certain condition is satisfied. For example, the following statements in an M-File will increase the variable x by 1 if it is positive and decrease it if it is negative: if x0 Pp+1; end if p>length(x) p-o; end (b) Create a function sumcomp that compares the sum of all the odd-indexed elements with the sum of all the even-indexed elements and returns: 0, if they are equal 1, if the sum of the odd-indexed elements is greater (b) Create a function sumcomp that compares the sum of all the odd-indexed elements with the sum of all the even-indexed elements and returns: 0, if they are equal, 1, if the sum of the odd-indexed elements is greater, 2, if the sum of the even-i indexed elements is greater

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions