把a定义成全局变量就好了
clear all
clc
global a
a = input('请输入a值'); % a是变量值,需要输入
fun1 = @mytry ;
x0 = [0,0];
x = fsolve(fun1,x0)
function F = mytry(x)
global a
F(1) = x(1) - x(2) -a;
F(2) = 2*x(1) - 8*x(2) -4;
end
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!