程序提示:The expression to the left of the equals sign is not a valid target for an assignment.程序如下:function y=K(k)%program to compute the complete eliptic integrals K(k)%Using the arith-geom mean method[m n]= size(k);if m+ n= =2K=[k

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/03 06:46:05
程序提示:The expression to the left of the equals sign is not a valid target for an assignment.程序如下:function y=K(k)%program to compute the complete eliptic integrals K(k)%Using the arith-geom mean method[m n]= size(k);if m+ n= =2K=[k

程序提示:The expression to the left of the equals sign is not a valid target for an assignment.程序如下:function y=K(k)%program to compute the complete eliptic integrals K(k)%Using the arith-geom mean method[m n]= size(k);if m+ n= =2K=[k
程序提示:The expression to the left of the equals sign is not a valid target for an assignment.
程序如下:
function y=K(k)
%program to compute the complete eliptic integrals K(k)
%Using the arith-geom mean method
[m n]= size(k);
if m+ n= =2
K=[k k];
end
if m= =1
k= k';
end
a(:,1)=ones(k);
b(:,1)=sqrt(ones(k)-k.*k);
c(:,1)=k;
i=1;
while max(c(:,1))>eps
a(:,i+ 1)=.5*(a(a:,i)+b(:,i));
b(:,i+ 1)=sqrt(a(:,i).*b(:,i));
c(:,i+ 1)=.5*(a(:,i)-b(:,i));
i=i+1
end
t=pi*ones(k)./(2*a(:,i));
if m+n= =2
y=t(1,:);
elseif m= =1
y= t';
else
y= t;
end
运行debug后提示
Error:File:F:\matlab7\work\K.m Line:5 Column:8
The expression to the left of the equals sign is not a valid target for an assignment.
错在哪了呢

程序提示:The expression to the left of the equals sign is not a valid target for an assignment.程序如下:function y=K(k)%program to compute the complete eliptic integrals K(k)%Using the arith-geom mean method[m n]= size(k);if m+ n= =2K=[k
下次提问时,最好在前面加上:“计算机编程求助”等类似的话.
不然系统自动把你的问题分到“英语考试”里来了,这里很少有人能帮到你.