Find the first values of a function
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Christopher Guerrero
el 3 de Jun. de 2017
Comentada: Christopher Guerrero
el 3 de Jun. de 2017
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
0 comentarios
Respuestas (2)
Walter Roberson
el 3 de Jun. de 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);
0 comentarios
Image Analyst
el 3 de Jun. de 2017
Editada: Image Analyst
el 3 de Jun. de 2017
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 comentarios
Ver también
Categorías
Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!