Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Compare and contrast the two methods used to generate the two MATLAB arrays x 1 and x 2 in the following MATLAB code: % T

Compare and contrast the two methods used to generate the two MATLAB arrays x1 and x2 in the following MATLAB code:
% T. Obuchowicz
%Fri Apr 2716:03:27 EDT 2012
clear
n =[1 : 20]
x1= sin((2*pi/40)* n).* cos((2*pi/40)* n) for index =1 : 20
% Note: In MATLAB, no need to pre-allocate the array,
% unlike C++ and other high-level programming languages. x2(index)= sin((2*pi/40)* index)* cos((2*pi/40)* index)
end
subplot(2,1,1) stem(n, x1)
title(Elegant method making full use of MATLABs array capabilities) xlabel(n)
ylabel(x[n])
subplot(2,1,2) stem(n, x2)
title(Gets the job done, but it is a lot of work and we are not in the MATLAB mindset)
xlabel(n) ylabel(x[n])

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

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago