could anyone help me to solve the issue

17 visualizaciones (últimos 30 días)
jaah navi
jaah navi el 4 de Jul. de 2019
Respondida: Image Analyst el 4 de Jul. de 2019
I want to plot the graph with respect to the following code:
x=1:10
for x=1:10
y=log(x)
end
plot (x,y,'*')
When I run the code I am unable to get the correct result.
What I actually need is i want to plot the graph with respect to all values.
Could anyone please help me on it?

Respuesta aceptada

KSSV
KSSV el 4 de Jul. de 2019
Editada: KSSV el 4 de Jul. de 2019
x=1:10 ;
y = zeros(size(x)) ;
for i=1:length(x)
y(i)=log(x(i)) ;
end
plot (x,y,'*')
No for loop needed
x = 1:10 ;
y = log(x) ;
plot(X,y,'-*')

Más respuestas (1)

Image Analyst
Image Analyst el 4 de Jul. de 2019
Try this:
x=1:10
y=log(x)
plot (x,y,'b*-')
grid on;
xlabel('x');
ylabel('y');
0001 Screenshot.png

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by