MATLAB question I dont think I got it right

  • Thread starter Thread starter O.J.
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
The discussion revolves around a MATLAB code for evaluating and plotting the convolution of two functions, y[n] = 2^n u[n+4] * u[n-3]. The user expresses concern that the plot does not seem to converge, despite changing the parameter n0 to various values. Responses clarify that the convolution of the two functions is not finite in length, which explains the consistent appearance of the plot across different n0 values. Additionally, it is noted that specific questions may receive fewer responses, and frequent bumping of the post can deter engagement. Overall, the user is encouraged to verify their results through analytical methods like the Laplace transform.
O.J.
Messages
198
Reaction score
0

Homework Statement



evaluate and plot this convolution:

y[n] = 2^n u[n+4] * u[n-3]

Homework Equations


The Attempt at a Solution



This is my code:

n0 = 20;
n = -n0:n0;
u1 = (n+4)>=0;
f1 = 2.^n;

x = f1 .*u1;
h = (n-3)>0;
y = conv (x,h);
l = length(x)+length(h)-1;
k2 = linspace(-n0,n0, l);
stem (k2, y);
xlabel ('n');
ylabel ('impulse response');
title ('System unit impulse resopnse Q1');I get a plot, but I get suspicious about it because it doesn't seem to converge, so i change n0 (just to see) and make it 100, it still looks the same. I make it 1000, 0,-10, it still looks the same which tells me there is something wrong in my code. Awaiting your help.
 
Physics news on Phys.org
Can some1 help please?
 
bump!
 
can I know why no one is responding? is my question vague? am i doing something wrong/violating any rules?
 
Well, you think that it's incorrect, so what do you think the plot *should* look like? Have you, on paper, taken the Laplace transform of the two functions, multiplied them, and then applied an inverse transform?

FWIW, I plot what you have, and it does converge (or at least come down from its peak value to the right of the maxima). As for why it looks similar when you try n0=1000 (and explodes to pretty large values) realize that neither function is finite in length, and thus, neither is the convolution of the two (at least, when you consider the convolution from -inf to inf). By selecting a terminating value of n0, you arbitrarily truncate those functions at those values.

When you ask very specific questions, its often hit or miss as to whether or not someone remembers it right off the bat. I (barely) remember convolutions as I haven't used this in a while. Also, people are usually more inclined to respond to posts that have no responses. By the process of bumping (and bumping several times), people are less likely to respond to, or even read, your post because they see that there are replies.
 
Thread 'PLL - How to find all the gains of a PI corrector and fix Ki ? MATLAB'
Hello everyone, it's not really for my homework (because I'm not at school anymore) but I'm new and I don't know how to start a new forum. I've never done automatic before and I need help. I have a 2nd ordre PLL on MATLAB, with an NCO and a PI corrector; the PLL works via the Mid/End algorithm (that's part is ok). I need to find the link between the theoretical formulas and their values in the code to find the value of the gain Ki, and possibly that of Kp if it's not correct. Unfortunately...
Thread 'Have I solved this structural engineering equation correctly?'
Hi all, I have a structural engineering book from 1979. I am trying to follow it as best as I can. I have come to a formula that calculates the rotations in radians at the rigid joint that requires an iterative procedure. This equation comes in the form of: $$ x_i = \frac {Q_ih_i + Q_{i+1}h_{i+1}}{4K} + \frac {C}{K}x_{i-1} + \frac {C}{K}x_{i+1} $$ Where: ## Q ## is the horizontal storey shear ## h ## is the storey height ## K = (6G_i + C_i + C_{i+1}) ## ## G = \frac {I_g}{h} ## ## C...

Similar threads

Back
Top