📄 rc.m
字号:
function q=rc(varargin)
%This programme solves various formulaes for diode connected to rl load
%This function also offers graph for the function selected
%This function runs independently as well as with "power_electronics"
%In order to execute this function type ''rl_load'' on command prompt
fprintf('Welcome From Worldhitter')
h=menu('Choose What You Want To Be Calculated','Vc(t)','dVc(t)/d(t)','dVc(t)/d(t) at t=0','i(t)');
%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
%_________________________________________________________________________
if( h == 1 )
fprintf('\nProvide The Following Data : ')
Vs=input('\nEnter The Source Voltage(Volts) :')
t=input('Enter The Time(Seconds) :')
R=input('Enter The Resistance(Ohms) :')
C=input('Enter The Capacitanace(farads) :')
fprintf('Wait For 2 Seconds :')
pause(2)
y=exp(-t./(R*C));
Vc=Vs*(1-y)
fprintf('Now We will Proceed Towards The Graphical Representation')
pause(1)
%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Data=1:64;Data=(Data'*Data)/64;
CreateStruct.WindowStyle='replace';
CreateStruct.Interpreter='tex';
h=msgbox('Vc=Vs(1-e^t/RC)','Graph Equation','custom',Data,hsv(64),CreateStruct);
%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
t1=linspace(pi/1000,2*pi);
y=exp(-t1./(R*C));
Vc=Vs*(1-y);
l=menu('Choose The Line StVcle','-','--',':','.','-.')
type=['-','--',':','.','_.'];
plot(t1,Vc,t1,Vc,type(l))
m=menu('Choose A Data Marker','+','o','*','x','.','s','d','^','v','>','<','p','h');
type=['+','o','*','x','.','s','d','^','v','>','<','p','h'];
plot(t1,Vc,t1,Vc,type(m) )
hold on
c=menu('Choose The Line Color','r','g','b','c','m','y','k','w','Strange')
type=['r','g','b','c','m','Vc','k','w','Strange'];
plot(t1,Vc,t1,Vc,type(c))
hold off
pause(1)
if (c == 9)
plot(t1,Vc,'-mo',...
'LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor',[.49 1 .63],...
'MarkerSize',12)
end
xlabel('Time')
ylabel('Vc(t)')
pause(1)
closereq
msgbox('Thanx For Using My Programme ','','custom',Data,cool(64))
pause(1)
closereq
thanks4(1) %Function call
%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
elseif (h == 2)
fprintf('\nProvide The Following Data : ')
Vs=input('\nEnter The Source Voltage(Volts) :')
t=input('Enter The Time(Seconds) :')
R=input('Enter The Resistance(Ohms) :')
C=input('Enter The Capacitanace(farads) :')
fprintf('Wait For 2 Seconds :')
pause(2)
y=exp(-t./(R*C));
dVcbydt=Vs*y/(R*C)
%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Data=1:64;Data=(Data'*Data)/64;
CreateStruct.WindowStyle='replace';
CreateStruct.Interpreter='tex';
h=msgbox('Vc=Vs(e^t/RC)','Graph Equation','custom',Data,hot(64),CreateStruct);
%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
t1=linspace(pi/1000,2*pi);
y=exp(-t1./(R*C));
Vc=Vs*(y);
l=menu('Choose The Line StVcle','-','--',':','.','-.')
type=['-','--',':','.','_.'];
plot(t1,Vc,t1,Vc,type(l))
m=menu('Choose A Data Marker','+','o','*','x','.','s','d','^','v','>','<','p','h');
type=['+','o','*','x','.','s','d','^','v','>','<','p','h'];
plot(t1,Vc,t1,Vc,type(m) )
hold on
c=menu('Choose The Line Color','r','g','b','c','m','y','k','w','Strange')
type=['r','g','b','c','m','Vc','k','w','Strange'];
plot(t1,Vc,t1,Vc,type(c))
hold off
pause(1)
if (c == 9)
plot(t1,Vc,'-mo',...
'LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor',[.49 1 .63],...
'MarkerSize',12)
end
xlabel('Time')
ylabel('dVc(t)/d(t)')
pause(1)
closereq
msgbox('Thanx For Using My Programme ','','custom',Data,cool(64))
pause(1)
closereq
thanks4(1) %Function call
%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
elseif (h == 3)
fprintf('\nProvide The Following Data : ')
Vs=input('\nEnter The Source Voltage(Volts) :')
R=input('Enter The Resistance(Ohms) :')
C=input('Enter The Capacitanace(farads) :')
fprintf('Wait For 2 Seconds :')
pause(2)
fprintf('This is The value of dVc(t)/d(t) at t=0 )')
dVcbydt=Vs/(R*C)
%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Data=1:64;Data=(Data'*Data)/64;
CreateStruct.WindowStyle='replace';
CreateStruct.Interpreter='tex';
h=msgbox('Vc=Vs/RC','Graph Equation','custom',Data,hot(64),CreateStruct);
%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
t1=linspace(pi/10,2*pi);
Vc=Vs/(R*C);
l=menu('Choose The Line StVcle','-','--',':','.','-.')
type=['-','--',':','.','_.'];
plot(t1,Vc,t1,Vc,type(l))
m=menu('Choose A Data Marker','+','o','*','x','.','s','d','^','v','>','<','p','h');
type=['+','o','*','x','.','s','d','^','v','>','<','p','h'];
plot(t1,Vc,t1,Vc,type(m) )
hold on
c=menu('Choose The Line Color','r','g','b','c','m','y','k','w','Strange')
type=['r','g','b','c','m','Vc','k','w','Strange'];
plot(t1,Vc,t1,Vc,type(c))
hold off
pause(1)
if (c == 9)
plot(t1,Vc,'-mo',...
'LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor',[.49 1 .63],...
'MarkerSize',12)
end
xlabel('Time')
ylabel('dVc(t)/d(t) at t=0')
pause(1)
closereq
msgbox('Thanx For Using My Programme ','','custom',Data,cool(64))
pause(1)
closereq
thanks4(1) %Function call
%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
elseif(h == 4)
fprintf('\nProvide The Following Data : ')
Vs=input('\nEnter The Source Voltage(Volts) :')
t=input('Enter The Time(Seconds) :')
R=input('Enter The Resistance(Ohms) :')
C=input('Enter The Capacitanace(farads) :')
fprintf('Wait For 2 Seconds :')
pause(2)
y=exp(-t./(R*C));
it=Vs*y/R
%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Data=1:64;Data=(Data'*Data)/64;
CreateStruct.WindowStyle='replace';
CreateStruct.Interpreter='tex';
h=msgbox('i(t)=Vs.Re^-t/RC','Graph Equation','custom',Data,pink(64),CreateStruct);
%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
t1=linspace(pi/10,2*pi);
y=exp(-t1./(R*C));
it=Vs*y/(R);
l=menu('Choose The Line StVcle','-','--',':','.','-.')
type=['-','--',':','.','_.'];
plot(t1,it,type(l))
m=menu('Choose A Data Marker','+','o','*','x','.','s','d','^','v','>','<','p','h');
type=['+','o','*','x','.','s','d','^','v','>','<','p','h'];
plot(t1,it,type(m) )
hold on
c=menu('Choose The Line Color','r','g','b','c','m','y','k','w','Strange')
type=['r','g','b','c','m','Vc','k','w','Strange'];
plot(t1,it,type(c))
hold off
pause(1)
if (c == 9)
plot(t1,it,'-mo',...
'LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor',[.49 1 .63],...
'MarkerSize',12)
end
xlabel('Time')
ylabel('i(t)')
pause(1)
closereq
msgbox('Thanx For Using My Programme ','','custom',Data,cool(64))
pause(1)
closereq
thanks4(1) %Function call
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -