Plot starts at 1
22 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Benedikt Schumacher
el 19 de Sept. de 2022
Comentada: Stephane Dauvillier
el 20 de Sept. de 2022
Hello everyone,
I have a plot what starts at one instead of zero.
Can someone tell me were my fail is?
B=app.BEditField.Value;
C=app.CEditField.Value;
D=app.DEditField.Value;
E=app.EEditField.Value;
x = linspace(0,pi,100);
y=D*sin(C*atan(B*x-E*(B*x-atan(B*x))));
plot(app.UIAxes,y);
app.UIAxes.YLim = [-0.2 (D+0.2)];
app.UIAxes.XLim = [-10 100];
0 comentarios
Respuestas (1)
Stephane Dauvillier
el 19 de Sept. de 2022
Hi you should use x and y in the plot command:
plot(app.UIAxes,x,y)
4 comentarios
Steven Lord
el 19 de Sept. de 2022
- If Y is a vector, the x-coordinates range from 1 to length(Y).
- If Y is a matrix, the plot contains one line for each column in Y. The x-coordinates range from 1 to the number of rows in Y."
In this case, app.UIAxes is not X data (which would cause MATLAB to use the plot(x, y) syntax.) It is recognized as an axes so the first syntax in Additional Options is used, then the remaining input is interpreted as Y data using the syntax above.
Stephane Dauvillier
el 20 de Sept. de 2022
your plot with x is the right one.The limits of the axes are not what you want but the data are well drawed.
ANd you can use the function below to set the limit of axes
xlim(app.UIAxes,[-10,100])
ylim(app.UIAxes,[-0.2,0.2+D])
Ver también
Categorías
Más información sobre Graphics Objects 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!