function f=fun(x); f=100*(x(2)-x(1)^2)^2+(1-x(1))^2; x=[1 2] fun(x)在MATLAB中运行后总出错?

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/27 06:29:14
function f=fun(x); f=100*(x(2)-x(1)^2)^2+(1-x(1))^2; x=[1 2] fun(x)在MATLAB中运行后总出错?
x)K+K.SH25*4 dhiThiVhj!dTF**@t=1Ɏ/Ox鄾g z9eMR>/(%g$V)*>;igKlZ۞.dGsd.\4<R>ٽh=bvv0ρ `(;,W Sb`Ub_\g dn}

function f=fun(x); f=100*(x(2)-x(1)^2)^2+(1-x(1))^2; x=[1 2] fun(x)在MATLAB中运行后总出错?
function f=fun(x); f=100*(x(2)-x(1)^2)^2+(1-x(1))^2; x=[1 2] fun(x)在MATLAB中运行后总出错?

function f=fun(x); f=100*(x(2)-x(1)^2)^2+(1-x(1))^2; x=[1 2] fun(x)在MATLAB中运行后总出错?
function f=chayou(x) % 在当前工作文件夹下保存为 chayou.m 文件
f=100*(x(2)-x(1)^2)^2+(1-x(1))^2;
%%%%%%%%%%%%%%%%%%%%%%%%%
运行以下:
>> x=[1 2]
x =
1 2
>> chayou(x)
ans =
100
>>