有人能告诉我这段代码有什么问题吗?
c = str2double(get(handles.edit6,'String'));
或者我怎样才能将编辑输入变为c的值?
命令窗口显示:'Warning: Infinite or Not-a-Number value encountered. '
(input of edit6 is '0')
孔函数代码:
function pushbutton1_Callback(hObject, eventdata, handles)
kpr = get(handles.slider1,'Value');
kir = get(handles.slider2,'Value');
kdr = get(handles.slider3,'Value');
e = handles.e;
a = 0;
b = 0;
c = str2double(get(handles.edit6,'Value'));
for t = handles.time;
ealt = e;
if t<handles.sprung
e = 0;
else
e = (a*t^2)+(b*t)+ c;
end
B(1,handles.ix) = e;
dedt = (e -ealt)/handles.h;
y = e*kpr + kir*(integral(@(x) 0*x+e,0,t-handles.sprung)) + kdr*dedt;
A(1,handles.ix) = y;
handles.ix = handles.ix+1;
hold on
plot(t,e)
end
handles.A = A;
plot(handles.time,handles.A,'r')