Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help with this matlab program part a and b ASAP with detail thank you ! MATLAB allows the user to create his own functions.
Need help with this matlab program part a and b ASAP with detail thank you !
MATLAB allows the user to create his own functions. To create a function newfun a text file must be created with the same filename as the function and the extension m, ie newfun.m. The first line of this file has the form: function [out1,out2]-newfun (inl, in2) output variable list input variable list function name We note that any number of input and output variables can be used. As an example, the following file oddeven.m defines the function oddeven that returns the odd-numbered and even-numbered elements of an arbitrary length vector. function [oddels, evenels]-oddeven(v,) oddels-v(1:2:1ength(v)); evenels-v(2:2:length(v)); a) Sinusoidal waveform generator. Let sinegen be a function whose output is a sine wave y(t)-sin(2ft). The inputs to the function should be the frequency f and the time vector t. Create the sinegen function i.e. the sinegen.m file). (b) Use sinegen to generate a sine wave with t ranging from 0 to 0.2 in 0.001 increments, and a frequency of 20 Hz. Plot the sine wave obtained in the outputStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started