What is u supposed to be? Some kind of vector you've previously defined? If so, and assuming u is a column vector whose j-th element corresponds to n=j-3 (e.g., the first element of u corresponds to n=1-3=-2, etc.):
I see, so you haven't actually defined u in your program anywhere, but in principle it's the Heaviside function, yes?
In that case, as I now understand it, you don't want to plot the value of y only for integer values of n (which is what I previously understood). In that case, you need to pick a "resolution" (i.e., the interval between successive values of n that you'll plot). Then:
res = 0.01; % resolution parameter
n = (-2:res:100).'; % vector of values of n from -2 to 100 spaced res apart
u = (n>=0); % Heaviside function; vector with 0 (false) if corresponding
% element of n is <0, 1 (true) if >0.
y = 3/40*(-3/4).^n.*u + 1/20*(1/2).^n.*u;
figure
plot(nvc,y)
In terms of the plot, this will plot things continuously. If instead you want to see the discontinuity at n=0, you can instead plot n<0 and n>=0 ranges separately:
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
0 Comments
Sign in to comment.