When i run my program i get the errror.How can i fix it ?
[X, Y]=meshgrid(-5:0.1:5);
Z=sin(X.*Y)./X;
C=contourf(X,Y,Z);
clabel(C)
grid on
figure
plot3(X,Y,Z);
hold on
grid on
xlabel('x');
ylabel('y');
title('Лінії рівня');
[res1,Fmin1]=fminsearch('f2',[0,1])
plot3(res1(1),res1(2),Fmin1,'ro-');
[res2,Fmin2]=fminsearch('f2',[0,-1])
plot3(res2(1),res2(2),Fmin2,'ro-');
figure
C=contourf(X,Y,Z);
clabel(C)
grid on
hold on
plot(res1(1),res1(2),'ro-');
plot(res2(1),res2(2),'ro-');

 채택된 답변

Walter Roberson
Walter Roberson 2020년 12월 7일

0 개 추천

When you use a quoted string as the first parameter to fminsearch then it needs to be the base name (without extension) of an executable file that is on your MATLAB path. It would typically name an m file such as f2.m but there are other possibilities

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by