I am trying to plot the frequency and duty cycle of a 555 timer's output, I have already calculated the equations I am trying to plot but I get an error whenever I try to actually plot them. The x axis needs to be logarithmic, and represents a varying resistor in the 555 timers outer circuitry. It goes from 1k to 100k ohms. Ra is another resistor set to 1k, and c is also constant. Here is my code:
ra = 1000;
x = 1000:100:100000;
c = .000000047;
figure;
y1 = 1/((ra+x)*c + (x*c));
y2 = ((ra+x)*c)/((ra+x)*c + (x*c)) * 100;
semilogx(x,y1);
semilogx(x,y2);
legend('Frequency, Hz','Duty Cycle in %');
xlabel('Rb in Ohms');
title('555 timer graph');
the error that I get is:
>> fiveFiveFive Error using / Matrix dimensions must agree.
Error in fiveFiveFive (line 13) y1 = 1/((ra+x)*c + (x*c)); % 1/T is the frequency