Hi!
I'm having problems with the code when solving differential equations by ode45.
The point is that I must enter singular functions from GUIDE:
u(t) -> Step. " ONLY THE HEAVISIDE FUNCTION ALLOWS ME"
Code:
vin=get(handles.editE,'String');vin=strrep(vin,'u','heaviside');t=(str2double(get(handles.editI,'String')):0.001:str2double(get(handles.editF,'String')));tspan = [0 9];vs=(str2double(get(handles.editPVI,'String')));R=(str2double(get(handles.editR,'String')));C=(str2double(get(handles.editC,'String')));tau = R*C;syms t;
NOW HERE I TRIED:
vin = eval (vin) -> not working.vin = symfun (vin, t) -> not working.syms vin -> not working.
.
f =@(t,v) vin/tau-v/tau; v0=0;% works like this (literally the function):
% f =@(t,v) heaviside(t)/tau-v/tau; v0=0;
% [t,v] = ode45(f,tspan,v0)
But I can not put this function as such, since vin can be a step, pulse, ramp, an exponential function, etc …
[t,v] = ode45(f,tspan,v0);axes(handles.axesVc);grid onplot(t,v);
Somebody help me 🙁
Best Answer