请帮我修改一下程序
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%a=imread('tu2.bmp');
I=double(a);
n=20;
total1=0;
total2=0;
R=100;
for t=0:pi/30:2*pi;;
for i=0:n-1;
x=R*i*cos(t)/n;
y=R*i*sin(t)/n;
x=round(x);
y=round(y);
up=I(x+128,y+128).*sin(2*pi*i/n);
down=I(x+128,y+128).*cos(2*pi*i/n);
total1=up+total1;
total2=down+total2;
end
putha=atan(total1/total2);
end
plot(t,putha)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
我想画出(t,putha)的曲线图,却只得到一个点,如何才能画出曲线啊。 原帖由 seavy 于 2006-11-15 10:37 发表
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a=imread('tu2.bmp');
I=double(a);
n=20;
total1=0;
total2=0;
R=100;
for t=0:pi/30:2*pi;;
for i=0:n-1;
x=R*i*cos(t)/n;
y=R*i*sin(t)/n;
x= ...
建议补补matlab的基础知识(相对于你写的循环条件),还有其他编程语言例如C语言什么都好(相对于你写的循环体) 没那么多精力啊,凑合着用就行了,这个程序我运行没错误,就是画不出图形啊,小改一下能运行出来不 原帖由 seavy 于 2006-11-15 10:47 发表
没那么多精力啊,凑合着用就行了,这个程序我运行没错误,就是画不出图形啊,小改一下能运行出来不
这年头,每个人都很忙,呵呵。建议用数组实现 a=imread('tu2.bmp');
I=double(a);
n=20;
total1=0;
total2=0;
R=100;
for t=0:pi/30:2*pi;;
for i=0:n-1;
x=R*i*cos(t)/n;
y=R*i*sin(t)/n;
x=round(x);
y=round(y);
up=I(x+128,y+128).*sin(2*pi*i/n);
down=I(x+128,y+128).*cos(2*pi*i/n);
total1=up+total1;
total2=down+total2;
putha=atan(total1/total2);
plot(t,putha)
hold on
end
end
页:
[1]