matlab 就是个简单的输入几个数 计算后又输出 另一个数那种function calculate_Callback(hObject,eventdata,handles)% hObject handle to calculate (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles st
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/26 02:26:06
matlab 就是个简单的输入几个数 计算后又输出 另一个数那种function calculate_Callback(hObject,eventdata,handles)% hObject handle to calculate (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles st
matlab 就是个简单的输入几个数 计算后又输出 另一个数那种
function calculate_Callback(hObject,eventdata,handles)
% hObject handle to calculate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
function F =myfun(X)
Is=X(1);
n2=X(2);
n3=X(3);
n4=X(4);
n5=X(5);
n6=X(6);
F(1)=log(n2*n6^2/145*handles.metricdata.p*handles.metricdata.gasco*exp(145*handles.metricdata.p(2.84*10^(-4)-1.255/(1.8*handles.metricdata.t+492))))+5.85+15.19*10^(-3)*(1.8*handles.metricdata.t+32)-1.64*10^(-6)*(1.8*handles.metricdata.t+32)^2-764.15*10^(-5)*handles.metricdata.p-3.334*sqrt(0.5*(4*n2+n6+n3*4+n4*4+n5*4))+1.431*0.5*(4*n2+n6+n3*4+n4*4+n5*4)-Is
F(2)=log(n2*n3)+3.47+1.8*10^(-3)*(1.8*handles.metricdata.t+32)+2.5*10^(-6)*(1.8*handles.metricdata.t+32)^2-855.5*10^(-6)*handles.metricdata.p-1.13*sqrt(0.5*(4*n2+n6+n3*4+n4*4+n5*4))+0.37*0.5*(4*n2+n6+n3*4+n4*4+n5*4)-2.0*10^(-3)*sqrt(0.5*(4*n2+n6+n3*4+n4*4+n5*4))*(1.8*handles.metricdata.t+32)-Is
F(3)=log(n2*n3)+4.04+1.9*10^(-3)*(1.8*handles.metricdata.t+32)+11.9*10^(-6)*(1.8*handles.metricdata.t+32)^2-1000.5*10^(-6)*handles.metricdata.p-1.66*sqrt(0.5*(4*n2+n6+n3*4+n4*4+n5*4))+0.49*0.5*(4*n2+n6+n3*4+n4*4+n5*4)-0.66*10^(-3)*sqrt(0.5*(4*n2+n6+n3*4+n4*4+n5*4))*(1.8*handles.metricdata.t+32)-Is
F(4)=log(n2*n3)+2.52+9.98*10^(-3)*(1.8*handles.metricdata.t+32)+0.97*10^(-6)*(1.8*handles.metricdata.t+32)^2-445.15*10^(-6)*handles.metricdata.p-1.09*sqrt(0.5*(4*n2+n6+n3*4+n4*4+n5*4))+0.5*0.5*(4*n2+n6+n3*4+n4*4+n5*4)-3.3*10^(-3)*sqrt(0.5*(4*n2+n6+n3*4+n4*4+n5*4))*(1.8*handles.metricdata.t+32)-Is
F(5)=log(n3*n4)+6.11+2*10^(-3)*(1.8*handles.metricdata.t+32)+6.4*10^(-6)*(1.8*handles.metricdata.t+32)^2-667*10^(-6)*handles.metricdata.p-1.89*sqrt(0.5*(4*n2+n6+n3*4+n4*4+n5*4))+0.67*0.5*(4*n2+n6+n3*4+n4*4+n5*4)-1.9*10^(-3)*sqrt(0.5*(4*n2+n6+n3*4+n4*4+n5*4))*(1.8*handles.metricdata.t+32)-Is
F(6)=log(n5*n2)+10.03-4.8*10^(-3)*(1.8*handles.metricdata.t+32)+11.4*10^(-6)*(1.8*handles.metricdata.t+32)^2-696*10^(-6)*handles.metricdata.p-2.62*sqrt(0.5*(4*n2+n6+n3*4+n4*4+n5*4))+0.89*0.5*(4*n2+n6+n3*4+n4*4+n5*4)-2*10^(-3)*sqrt(0.5*(4*n2+n6+n3*4+n4*4+n5*4))*(1.8*handles.metricdata.t+32)-Is
X=fsolve('myfun',[0,handles.metricdata.ca,handles.metricdata.so,handles.metricdata.sr,handles.metricdata.ba,handles.metricdata.coh],optimset('Display','off'))
answer=X(1);
set(handles.answer,'String',answer);
它就是不输出.是什么原因啊?
内容你别看着长 其实就是几个非线性方程而已
matlab 就是个简单的输入几个数 计算后又输出 另一个数那种function calculate_Callback(hObject,eventdata,handles)% hObject handle to calculate (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles st
handles.metricdata.p 类似的,这里的数据你保存了吗?不然从哪里传递到你想用的地方?……