How can I evaluate a function at a vector and plot the returned values?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Japheth Gielen
el 9 de Oct. de 2016
Comentada: Japheth Gielen
el 9 de Oct. de 2016
Using this function code: function [y1,y2] = f(x1)
y1 = 6*sin(x1) + cos(2*x1)
y2 = 12*sin(2*x1) + cos(4*x1)
end
I need to evaluate it at multiple points using the vector: x1 = linspace(0, 2*pi, 10);
So, I entered this code on my main script:
x1 = linspace(0, 2*pi, 10);
ii = f(x1)
It returns the error: Subscript indices must either be real positive integers or logicals.
Can someone please tell me what I am doing wrong? I know this is basic, but I am new to Matlab and my class on it isn't very helpful.
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical 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!