Question
Produce following function in MATLAB
eeeceved. 3) calculatelmpulse: consumes a series (represented by a column-vector of floats)- and computes the integral-of the
0 0
Add a comment Improve this question Transcribed image text
Answer #1

= caculate!mpulse.m RUNV octave:2> calculateImpulse([0.0,1.5,2.5,3,2.5,1.5,0.0]) ntegralValue = 11 #save this following code= calculate!mpulse.m RUNVa octave: 17> calculateImpulse() 1XIntegralValue 38 #defining a function for our integral calculatio

#save this following code in calculateImpulse.m to work as a userdefined function
#defining a function for our integral calculation which accepts an array of elements
function calculateImpulse(ArrayOfFloats)
#calling inbuilt method in matlab to calculate Integral value
IntegralValue = trapz(ArrayOfFloats)
#plotting with matlab plot function
plot(ArrayOfFloats)
end

#calling the above function from command line (or we can call from other function also)

>>> calculateImpulse([0.0,1.5,2.5,3,2.5,1.5,0.0])

#result

IntegralValue =  11
Add a comment
Know the answer?
Add Answer to:
Produce following function in MATLAB eeeceved. 3) calculatelmpulse: consumes a series (represented by a column-vector of floats)- and computes the integral-of the series using trapezoidal numeric...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • (a) (4 points) Fill in the blanks in the following MATLAB function M file trap so...

    (a) (4 points) Fill in the blanks in the following MATLAB function M file trap so that it implements the composilu trapezidul rulo, using a soquence of w -1,2, 4, 8, 16,... trapezoids, to approximatel d . This M file uses the MATLAB built-in function trapz. If 401) and y=() f(!)..... fr. 1)). 3= ($1, then the execution of z = trapz(x, y) approximates using the composite trapezoidal rule (with trapezoids). (Note that the entries of are labeled starting at...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT