Domanda

I wanna solve this form of equation: x' = -A.x + B.|sin(100*pi*t)| and i use ode45 like this:

function find_x
t = 0:0.001:10;
x0 = 0;
R1 = 90000;
R2 = 1000;
C = 0.001;
[t,x]=ode45(@rhs, t , x0);

plot(t,x);

    function dxdt = rhs(t,x)
        dxdt = -(C/R1 + C/R2)*x + C/R1*abs(sin(100*pi*t)) ;
        %It's form is dx/dt = -A.x + B.U(t)
    end
end

but i think it give me the wrong answer. actually, i get this equation from a problem "find output voltage form after a diode bridge and a capacitor" like this: enter image description here

can anyone suggest to me a another way to solve it ? thanks.

È stato utile?

Soluzione

Not really the place to solve this, and this takes me back to my signal & systems days, but basically your equations should have C as a divider...

Remember it's

I = C *dV/dt

Therefore if you have dV/dt on the RHS, you should expect to see 1/C on the LHS:

function khan
t = 0:0.001:10;
x0 = 0;
R1 = 90000;
R2 = 1000;
C = 0.001;
options = odeset('RelTol',1e-6,'AbsTol',1e-8);
[t,x]=ode45(@rhs, t , x0,options);

plot(t,x);

    function dxdt = rhs(t,x)
        dxdt = -(1/R1 + 1/R2)*x/C + 1/R1*abs(sin(100*pi*t))/C ;
        %It's form is dx/dt = -A.x + B.U(t)
    end
end

enter image description here

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top