plotting in a loop with a function
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Benjamin
el 5 de Mzo. de 2019
Comentada: Benjamin
el 5 de Mzo. de 2019
I have the following code:
for x = 1:0.01:1.5
z = g(x,rpf);
end
but when I run this (assume my function is correct), I only get that z is equivalent to the last data point. How can I store x and z in a matrix and then plot them?
0 comentarios
Respuesta aceptada
Bob Thompson
el 5 de Mzo. de 2019
You need to index z with each loop.
count = 0;
for x = 1:0.01:1.5;
count = count + 1;
z(count) = g(x,rpf);
end
plot(x,z)
7 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Annotations 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!