555 timer plots in matlab
11 ビュー (過去 30 日間)
古いコメントを表示
Hi guys !
I want to implement the formulas for vo and vc for a 555 astable multivibrator circuit. I wrote the formulas for vc but it doesn't work. If anyone could help me, I would be very pleased.
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')
3 件のコメント
Cris LaPierre
2018 年 12 月 28 日
編集済み: Cris LaPierre
2018 年 12 月 28 日
Using the values shared in this page for a 555 electronic metronome, your code appears to work. I put in the values for 180bpm (3/sec) and got this plot.

I therefore suspect your issue has more to do with making this work in a gui.
回答 (1 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
