Two-dimensional curve drawing of matlab learning

%% The
%plot function is used to create a simple line graph drawn from x and y values.
x=0:0.05:5;
y=sin(x.^2);
figure
plot(x,y);
y1 = sin(x.^2);
y2 = cos(x.^2);
plot(x, y1,x,y2)
%% The
%bar function is used to create a vertical bar graph. The barh function is used to create a horizontal bar chart.
x = -2.9:0.2:2.9;
y = exp(-x.*x);
bar(x,y)

%%
%stairs function is used to create a ladder diagram. It can create a ladder diagram containing only Y values, or a ladder diagram containing both x and y values.
x=0:0.25:10;
y=sin(x);
stairs(x,y);

The %%
%errorbar function can draw a line graph of x and y values ​​and superimpose vertical error bars on each observation point. To specify the size of the error bar, you need to pass an additional input parameter to the errorbar function.
x = -2:0.1:2;
y = erf(x);
eb = rand(size(x))/7;
errorbar(x,y,eb)

The %%
%polarplot function can draw a polar plot of the angle value (in radians) in theta versus the radius value in rho.
theta=0:0.01:2*pi;
rho=abs(sin(2*theta).*cos(2*theta));
polarplot(theta,rho);

The %%
%stem function draws a marker for each x and y value connected to a common baseline by a vertical line.
x=0:0.1:4;
y=sin(x.^2).*exp(-x);
stem(x,y);
%%
%scatter function is used to draw a scatter plot of x and y values
load patients Height Weight Systolic% load data
scatter(Height,Weight)% scatter plot of Weight vs. Height
xlabel('Height')
ylabel('Weight')

Guess you like

Origin blog.csdn.net/seek97/article/details/90147284