CS计算机代考程序代写 matlab EE103L

EE103L
Introduction to Matlab
Assignment 1
Name:
Date:

If a question asks for results and graphs, please declare them clearly. Some of questions may also ask for a solution like “which one is better?”, so please state your answer with a detailed explanation. In addition, you should copy the code for each section if it is possible to be separated. If it is not possible, you should copy the code entirely with clearly comments in the end of the report.

• Create the vector x = [1,2,…,100]. Assign the even numbers of x to a new vector y.

Results:

Code:
close all
clear all
clc
x=1:1:100; % Comments
y=[]; % Comments
for ii=1:length(x) % Comments
if mod(x(ii),2)==0 % Comments
y=[y x(ii)]; % Comments
end

Graphs:

• Use for loop to find the values of for t = 0, 01, 0.2, 0.3, 0.4 s when f =10, 15, and 20 Hz. Use one set of statements to compute the values for all three frequencies and store the results in a two-dimensional array. Use two nested for loops and double indexing.

Results:

Code:

Graphs:

• Use while loop to find the largest value of positive t for which and are both less than 10. Make the computation for ω=35, 40, and 45. Find your answers to the nearest 0.01.
Results:

Code:

Graphs:

• Create a 15-element vector with values of at equally spaced interval. Find the maximum element value, the minimum element value, the average of the element values, and the indices of the elements for which the element magnitude is greater than 4.

Results:

Code:

Graphs:

• Assume, and, where and . Plot, and v/s with on the same graph (you have to use hold on command). Label the axes and create legends for each graph.

Results:

Code:

Graphs:

• Sinc function is a function that arises frequently in our course. It is defined as

Create a Matlab function MySinc () that defines sinc(x) function following the above definition. Plot the value sinc(x) in the interval [-2π 2π] using MySinc () function and Matlab inbuilt sinc() function on the same graph.

Results:

Code:

Graphs: