Find the first values of a function
Afficher commentaires plus anciens
I have searched and am looking for information on how to input this and solve for this using matlab? I don't need this one specifically but an example on the code would really help me on how to get started.
Find the first seven values (i.e., x(n) for n = 0 to 6) of the function
x(n) = [2nu(n)] - [(n-3)u(n-3)] - [3u(n-4)]
Find the first seven values (i.e., x(n) for n = 0 to 4) of the function
Réponses (2)
Walter Roberson
le 3 Juin 2017
Use a for loop.
Note:
u = @(x) x >= 0;
However, there is room for argument about whether this should instead be
u = @(x) x > 0;
or even
u = @(x) (x > 0) + 1/2 * (u == 0);
Image Analyst
le 3 Juin 2017
Modifié(e) : Image Analyst
le 3 Juin 2017
0 votes
What is u? Is it a scalar, a function, or an array?
If it's a scalar, is 2nu(n) really equal to 2*n*u*n?
Or if u is a vector is 2nu(n) really equal to 2*n*u(n)? But you can't have n = 0 since vectors can't have an index of 0. So explain that.
Or is u some function? If so, what is the function? For example u(n) = 5*n+log(n)+sin(n) or whatever? In this case - u is a function - then n can take on a value of 0, unlike if u were a vector.
Also explain this: "first seven values (i.e., x(n) for n = 0 to 4)". How is that seven values and not five values? If n is integers, then n = 0, 1, 2, 3, and 4, which is 5 values. If n is floating point, then n is 0, 0.666, 1.333, 2, 2.666, 3.333, 4. But then you can't use n as array indexes if you're having u be a vector, though fractional values for n are okay if u is a function.
2 commentaires
Star Strider
le 3 Juin 2017
I interpret ‘u(n)’ as the unit or heaviside step function.
Christopher Guerrero
le 3 Juin 2017
Catégories
En savoir plus sur Resizing and Reshaping Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!