Plotting results on log scale

6 visualizaciones (últimos 30 días)
Omar Lee
Omar Lee el 20 de Mzo. de 2020
Respondida: Sriram Tadavarty el 20 de Mzo. de 2020
So i wrote this program but need to plot the rmin results but cant get it to work...i tried plot(1:100,rmin) but dont get the desired result...i only want to plot the rmin values
for j=1:1000
x = x + vx*dt;
vx = vx - sign(vx - hw)*Cd/m*(vx -hw)^2*dt;
y=y + vy*dt;
vy = vy +(-g-sign(vy)*Cd/m*vy ^2)*dt;
r(j)=((((x-xt)^2)+((y-yt)^2))^(1/2));
rmin(i)=min(r);
vx=0;
vy=0;
x=0;
y=0;
end
end
newp=[rmin;m;Cd;v0;theta]';
The rmin values of newp is what i want plotted on a log scale

Respuestas (1)

Sriram Tadavarty
Sriram Tadavarty el 20 de Mzo. de 2020
Hi Omar,
To plot the values in logarithmic scale, you can use loglog, semilogx, and semilogy plot functions.
If you are not sure, which plot to use, you can go to the Plots option in the MATLAB toolstrip and then select a workspace varaible, that provides you which plot is suited.
Hope this helps,
Regards,
Sriram

Categorías

Más información sobre Genetic Algorithm 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!

Translated by