matlab waveform help

Discussion in 'Programmer's Corner' started by awesome2999, Apr 14, 2010.

  1. awesome2999

    Thread Starter New Member

    Apr 10, 2010
    7
    0
    Hi there,
    I am completely new to matlab and don't know how to draw a waveform of

    matlab code
    VT=0.0252;
    vin=1.5+cos(2*pi*100*t);
    R=2000;
    Is = 1/10000000000000000;
    t=linspace(0,0.03,1000);
    Vout=-VT*log(vin/R*Is);
    plot(t,Vout);

    i don't know how to get the right answer because the Vout should be around 0.72 to .76sinewave form

    note: vin=1.5+cos(2*pi*100*t); means that peak value is 2.5 and lowest values is 0.5 which should be sub in Vout equation.

    please help me to get the right code
    thank-you for your help
    cheers
     
  2. guitarguy12387

    Active Member

    Apr 10, 2008
    359
    12
    One thing i can see: you have to define t before you use it in the vin line otherwise it will be zero.

    Thats all i can see thats obvious.
     
Loading...