Octave/matlab and op-amps

Discussion in 'Homework Help' started by Peytonator, Jul 1, 2008.

  1. Peytonator

    Thread Starter Active Member

    Jun 30, 2008
    105
    3
    Hi,

    I've collected 2 questions, with images attached. Help would be much appreciated!

    The first question is on the op-amps. It is this: How, considering the given diagrams, would I model an op-amp with a gain of 30?

    This is as much as I know: as in the op-amps with gain 50 and 200, I need to connect a 10uF CAP. But what resistor do I add - something lower than 1.2k, but what?

    Edit: Sorry about the inverted image!!

    ------

    My second question relates to OCTAVE. The exam question is attached. Here are my questions:

    1) In the code given, what do lines 2-4 mean. In specific, what does the following mean:
    (10+student)
    V(1:20)
    2) Is "length(t)" meant to replaced by a value?
    3) Why are is the y-axis "Volts", not current, since the code incorporates "current" formulae?
    5) How do I now find the answer in coulombs, no of electrons and mAs? On (b), I'm pretty much totally lost. I'm almost clueless about what questions to ask :confused:

    Here's my situation: I managed to get a graph out, but can't understand what to do with it. I've attached it below. I've hada look at a few Octave manual's on this subject, but it didn't find it very applicable to the question.

    Any help is very much appreciated!

    Thanks,

    Graham
     
    Last edited: Jul 1, 2008
  2. thingmaker3

    Retired Moderator

    May 16, 2005
    5,072
    6
  3. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    LM386 is not an op amp. It is an audio amp.
     
  4. Dave

    Retired Moderator

    Nov 17, 2003
    6,960
    144
    Line 2: student = 567/100

    This is a declaration of the variable student and assignment of the value 567/10

    Line 3: t = 0:.1:round(10+student)

    Firstly you need to note that in Octave (and Matlab) the semi-colon operator : is a code vectorisation operator. That is it will iteratively increment a variable from one value to another - similar to a loop in convention programming. So in this example you are declaring the variable array t, starting at 0, increasing in increments of 0.1 to a maximum of round(10+student).

    The round(10+student) is two mathematical operations in one - the first is (10+student) which merely adds 10 to the value of the student variable declared and calculated in Line 2. The second is the round() function which serves to round the value of (10+student) to the nearest integer (note that depending on you value of student, 10+student will most probably have several decimal places in the answer.

    Line 4: V(1:20) = 2*t(1:20)

    Is classic vectorisation code that would replace a for-loop. V(1:20) refers to the array V with elements 1 through to 20, and t(1:20) refers to the array t with elements 1 through to 20. The line V(1:20) = 2*t(1:20) takes the value of each element in t, multiplies it by 2 and assigns it to the corresponding element in V. Think of it in conventional programming:

    Code ( (Unknown Language)):
    1. for i = 1 to size(V)
    2. [INDENT]t_tmp = 2*t(i);
    3. v(i) = t_tmp;[/INDENT]
    4. end
    length(t) is a function that determine the length of the array t. Therefore length(t) would return the value 20,1 because the array t is a 20-by-1 array.

    Yeah, it looks like a typo to me. The array V should be I as well.

    Note an ampere is one coulomb of charge going past a given point in the duration of one second, and that one coulomb equals ~6.24150948 x10^18 electrons passing a point in space and time in one second.

    Dave
     
  5. Peytonator

    Thread Starter Active Member

    Jun 30, 2008
    105
    3
    Thanks very much for the very helpful replies! That clears up things a lot more.

    If I might ask one more question, relating to what thingmaker said: I'm alright with finding a particular gain, but what resistor or other circuit elements must I add to produce the gain of 30, given the circuit diagrams.

    I thought about using ratios somehow, but overall I am unsure.

    Graham
     
  6. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    What are you actually trying to do? The waveform you posted looks like an integrator. LM386 is not the part to use if you want to make an integrator. As I said, LM386 is not an op amp.
    If I'm on the wrong track, please straighten me out.:confused:
     
  7. thingmaker3

    Retired Moderator

    May 16, 2005
    5,072
    6
  8. Peytonator

    Thread Starter Active Member

    Jun 30, 2008
    105
    3
    Thanks for the helpful replies again!

    Thingmaker, I think the pdf you attached has the answer. Perhaps you could help me on just one point: the formula for gain includes an impedance between pins 1 and 5. How is this possible? Isn't there already one between pins 1 & 8? Excuse my ignorance :confused:

    Ron, here's the question again: "Design, using the LM386 data sheet, an audio amp with a gain of 30. Note: Look at the application circuits to determine the value of the compenents."
     
  9. thingmaker3

    Retired Moderator

    May 16, 2005
    5,072
    6
    Look at the figure on the first page of the datasheet. With no external components at all, the there is 1.35K between 1 and 8, and there is 1.5K between 1 and 5. You can change these values by adding the external components.
     
  10. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    The resistor between 1 and 5 is 15k, not 1.5k.To avoid upsetting the DC operating point, any resistors added in parallel should have capacitors in series with them.
     
  11. thingmaker3

    Retired Moderator

    May 16, 2005
    5,072
    6
    Yup. Definitely time for new eyeglasses.:rolleyes:
     
  12. Peytonator

    Thread Starter Active Member

    Jun 30, 2008
    105
    3
    This still hasn't answered my question :rolleyes: I suppose I should have asked it more clearly, though.

    I'm not looking for internal components of the audio-amp which I can't alter. My problem is what external resistor to add in series with a 10uF CAP) between pins 1 and 8 - see "Typical Applications" in the data sheet. What value resistor do I add?

    What I had in mind:

    If an audio amp with no resistor has a gain of 200, while one with a resistor of 1.2k has a gain of 50, then for a gain of 30, a slightly bigger resistor must be added. So using a ratio of gain/resistor, you get

    50/1200 = 1/24 = 30/R (R = unknown resistor)
    R = 720 ohms

    ... which isn't right. So what now?
     
  13. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    The gain equation in the link provided by thingmaker3 is posted below. You simply need to solve for Z(1-8) and put the resulting value, in series with a suitably large cap, across pins 1 and 8. Since this is a homework problem, you tell us what value you get for Z(1-8), and we will go from there.
    EDIT: Remember that Z1-8 is the parallel combination of the internal 1.35k resistor and your external network.
     
    Last edited: Jul 5, 2008
Loading...