clc
clear
subplot(2,2,1)
x=0:pi/1800:2*pi;
y=sin(x);
plot(x,y);
title('Plot of sin(x)');
grid
subplot(2,2,2)
x=0:pi/1800:2*pi;
y=sin(x-2*pi/3)
plot(x,y);
title('Plot of sin(x-120)');
grid
subplot(2,2,3)
x=0:pi/1800:2*pi;
y=sin(x+2*pi/3)
plot(x,y);
title('Plot of sin(x-240)');
grid
(try it)
M-File Programming For Three-Phase Voltage:
clc
clear
t=0:pi/1800:2*pi;
v1=100*cos(t);
plot(t,v1);
grid
hold on
v2=100*cos(t-2*pi/3);
plot(t,v2);
v3=100*cos(t+2*pi/3);
plot (t,v3);
title('Plotting Three-Phase Voltage of v1(t), v2(t) and v3(t)')
xlabel ('Time in seconds')
ylabel ('Voltage in volts')
text (6,6,'v1(t)')
text (3,4,'v2(t)')
text (1,1,'v3(t)')
(try it)
Discussion:
· Plotting figure is also called graphing figure in MATLAB.
· In this programming, we can easily draw a different kind of equation’s figure by MATLAB programming.
· In the first programming, we can combine multiple plots on the same page by using calls to the subplot(m,n,p) command.
· This command breaks the figure window into a m-by-n matrix of small subplots and selects the p-th subplot for the current plot.
· The subplots are numbered starting at 1 and increasing along rows to the value max at bottom right of the matrix.
· In the second programming, the program is a sequence of MATLAB commands that will allow us to do this.
· ; at the end of a line defines the command but does not immediately execute it.
· * is used to multiply two functions.
· The command ‘hold on’ keeps the existing graph and adds the next one to it.
· The command ‘plot’ can plot more than one function simultaneously.
· In the plot command we can specify the color line.
· So to say finally, MATLAB allow creating plots of functions easily.
Comments
Post a Comment