 The above example showing how change the characteristic of line (like colour, line weight...)
The above example showing how change the characteristic of line (like colour, line weight...)And here is the code:
function shili02
h0=figure('toolbar','none',...
    'position',[200 150 450 350],...
    'name','example2');
x=-pi:0.05:pi;
y=sin(x)+cos(x);
plot(x,y,'-*r','linewidth',1);
grid on
xlabel('×');
ylabel('Y');
title('y=sin(x)+cos(x)');
function shili02 %this indicate the function's name is shili02
h0=figure('toolbar','none',...      %
    'position',[200 150 450 350],...%opening a figure window and manipulate the figure
    'name','example2');% properties (further detail see example 1)
x=-pi:0.05:pi;   %x=-3.14159265, then adding -3.14159265+0.05, continue the adding 0.05             %until x=3.14159265
y=sin(x)+cos(x);
plot(x,y,'-*r','linewidth',1);%plotting x and y but letting the line making of * and red in colour
% and the line width is 1
you can change the '-*r' according to below reference
-     solid
:     dotted
-.    dashdot 
--    dashed   
(none)  no line
o     circle             
x     x-mark             
+     plus               
*     star             
s     square
d     diamond
v     triangle (down)
^     triangle (up)
<     triangle (left)
> triangle (right)
p     pentagram
h     hexagram
b =  blue         
g = green         
r  = red          
c = cyan         
m = magenta      
y = yellow       
k = black     
w = white
grid on
xlabel('×'); % labeling X the graph at x axis; you can change the name 'X' to anything you like
ylabel('Y'); %labeling Y the graph at Y axis; you can change the name 'Y' to anything you like
title('y=sin(x)+cos(x)'); %title of the graph, that is y=sin(x)+cos(x)
 
No comments:
Post a Comment