0% found this document useful (0 votes)
36 views3 pages

Extra Problems

The document describes solving a system of linear equations defined by an n×n matrix. It provides the matrix structure and defines it based on input parameters a, b, and n. It then asks to: 1) Create a MATLAB function called "Prob_2" that accepts the parameters and returns the solution vector x; 2) Call the function for the inputs: a=10, b=0.1, n=30 and a=2, b=-0.05, n=50. The solution defines the Prob_2 function to build the matrix, compute the inverse, and return x. It then calls the function for the two test cases.

Uploaded by

ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views3 pages

Extra Problems

The document describes solving a system of linear equations defined by an n×n matrix. It provides the matrix structure and defines it based on input parameters a, b, and n. It then asks to: 1) Create a MATLAB function called "Prob_2" that accepts the parameters and returns the solution vector x; 2) Call the function for the inputs: a=10, b=0.1, n=30 and a=2, b=-0.05, n=50. The solution defines the Prob_2 function to build the matrix, compute the inverse, and return x. It then calls the function for the two test cases.

Uploaded by

ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

For the following signal:

a. Plot the given time domain signal y(t).


b. Find the Fourier transform expression Y(w) of the signal y(t).
c. Plot Y(w).
y(t)

t
-1 3

Hand analysis to get the linear function:


Points from the graph: (-1,0) and (3,1)

𝑦 − 𝑦1 𝑦2 − 𝑦1
=
𝑡 − 𝑡1 𝑡2 − 𝑡1

𝑦−0 1−0
=
𝑡+1 3+1

Cross multiply and solve for y:


4y = t + 1
y = 0.25t + 0.25
Solution:
Therefore:
clc;
y(t) = 0.25t + 0.25
clear all;
close all;
syms t;
y = (0.25*t+0.25)*(heaviside(t+1)-heaviside(t-3));
t = -5:0.01:5;
yval = subs(y,t);
yval = double(yval);
plot(t,yval);
Y = fourier(y);
w = -2*pi:0.1:2*pi;
Yval = subs(Y,w);
Yval = double(Yval);
figure();
plot(w,Yval);
Problem 2:
Create a MATLAB function called “Prob_2” that:

a. Accepts three parameters a, b and n in that order.


b. Returns the solution of the following 𝑛 × 𝑛.
(Note: All entries in the matrix not explicitly mentioned are meant to be zero).

………
.. 𝟏
1𝑎00 1
.. 𝟐
0100 :
0 0 1 0 .. .. : 𝐱 = :
𝒏−2
: ....1 .. :
𝟎
: ...... 1 0 ( 𝒏 )
(𝑏 𝑏 . . . . 𝑏 1)

c. Write down the output of the function for the following inputs:
i. a=10, b=0.1 and n=30.
ii. a=2, b=-0.05 and n=50.

Solution:

Open a separate m-file called Prob_2 to write the function as follows:

function [x] = Prob_1(a,b,n)


A = eye(n);
A(2,1) = a;
A(n,1:n-1) = b;
B = 1:n;
B(n-1) = 0;
B = B';
x = inv(A)*B;
end

Save the function m- file and open another script:

clc;
clear all;
close all;
x = Prob_2(10,0.1,30);
then:
x = Prob_2(2,-0.05,50);

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy