555 timer plots in matlab.

Thread Starter

Vlad Hornai

Joined Dec 26, 2018
1
Hi everyone !
How can I display the plots of v0 and vcc for an astable multivibrator circuit. I have struggled to implement the equation, but it is kind of hard to make them work together. It is kind of hard for me to plot vc.
function voplot_Callback(hObject, eventdata, handles)
% hObject handle to voplot (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% plot Vo
ra = str2num(get(handles.edit1,'string'));
rb = str2num(get(handles.edit2,'string'));
c = str2num(get(handles.edit3,'string'))/1000000;
voh = str2num(get(handles.edit5,'string'));
vol = str2num(get(handles.edit6,'string'));

tc = 0.693*(ra+rb)*c;
td = 0.693*rb*c;
t = 0.693*(ra+(2*rb))*c;
d = (tc/t)*100; % duty cycle
f=1.45/((ra+2*rb)*c); % frequency
%Vi=0; %Vi should vary
%Vf=10; %Vf should vary


if f>100
p=0:1:200000;
out=2.5*square(2*pi*f*p,d)+2.5;
%VCcha = 10^(1-exp(-p./(ra+rb)*c)); %Vc charge
figure(1);
plot(p,out)

else
p=0:0.0001:5;
out=2.5*square(2*pi*f*p,d)+2.5;
% VCdis =0*exp(-p/rb*c); %Vc discharge
figure(1);

plot(p,out)
end
%subplot(2,1,1); plot(out)
%subplot(2,1,2); plot(VCcha)

ylim([0 6])
xlabel('Time(s)')
ylabel('Amplitude(V)')
title('Waveform of 555 Timer as an Astable Multivibrator')
 
Top