Understanding of plotting graphs on MATLAB:

Q: If R = 10 Ohms and the current is increased from 0 to 10 A with increments of 2 A,

Write MATLAB programs to plot:

**a) I-V**

__Commands on m-file__

R=[10];

% current is increased from 0 to 10A with increments of 2A

I=[0 2 4 6 8 10];

V=I*R

% To plot the graph between current and voltage

plot (I,V)

title(‘graph between current and voltage’)

xlabel(‘current in amperes’)

ylabel(‘voltage in volts’)

grid

__Graph between I-V__

**b) I-P**

__Commands on m-file__

R=[10];

% current is increased from 0 to 10A with increments of 2A

I=[0 2 4 6 8 10];

P=I.^2*R

% To plot the graph between current and power

plot (I,P)

title(‘Graph between Current and Power’)

xlabel(‘Current in amperes’)

ylabel(‘Power in watts’)

grid

__Graph between I-P__

**(c) I-V and I-P on same graph**

__Commands on m-file__

R=[10];

% Current increased from 0 to 10A with the increment of 2A

I=[0 2 4 6 8 10];

% to calculate Voltage

V=I*R

% to calculate Power

P=I.^2*R

plot(I,V,’b’,I,P,’r’)

title(‘Graph between I-V and I-P’)

xlabel(‘Current (Amperes)’)

ylabel(‘Voltage (Volts) and Power (Watts)’)

grid

__Graph between I-V & I-P__