| Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) | 
![]()  | 
	
| 
	 | 
| 		
			
			 | 
		#1 | 
| 
			
			 初级会员 
			
			
			
			注册日期: 2010-04-10 
				
				
				
					帖子: 1
				 
				
				
				声望力: 0 ![]()  | 
	
	
	
		
		
			
			 
			
			我的主程序是 
		
		
		
		
		
		
		
	m=rand(4,20); for o=1:1:20 n=m(:,o); i=0; for t=0:0.1:12; i=i+1; A=n(1,:); tower=n(2,:); Sigmag=n(3,:); tg=n(4,:); Z=((t-tg)/Sigmag)-(Sigmag/tower); x=(-1000:0.01:Z)'; y=(1/sqrt(6.28))*exp(-x.*x/2); Vt=trapz(x,y); V2(i)=(A/tower)*exp((Sigmag^2)/(2*tower^2)-((t-tg)/tower)); V2(i)=V2(i)*Vt; end end V1=dot(A,tower,tg,Sigmag); popuerr=sumsqr(V1,V2) 子程序是 function V1=dot(A,tower,tg,Sigmag) i=0; for t=0:0.1:12; i=i+1; A=2.51; tower=1.35; tg=7.0; Sigmag=1.15; Z=((t-tg)/Sigmag)-(Sigmag/tower); x=(-1000:0.01:Z)'; y=(1/sqrt(6.28))*exp(-x.*x/2); Vt=trapz(x,y); V1(i)=(A/tower)*exp((Sigmag^2)/(2*tower^2)-((t-tg)/tower)); V1(i)=V1(i)*Vt; end 提示 Error using ==> sumsqr Too many input arguments. Error in ==> ga at 33 popuerr=sumsqr(V1,V2) 我想得出sumsqr的20个标量的矩阵,为什么一直是这样的结果呢,循环那里出错了?再问下这个函数名function V1=dot(A,tower,tg,Sigmag)写的对吗?我要每次循环调用它做误差,谁会啊,我急需解决,谢谢了! 收藏 分享 评分  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#2 | 
| 
			
			 普通会员 
			
			
			
				
			
			注册日期: 2007-04-04 
				
				
				
					帖子: 91
				 
				
				
				声望力: 20 ![]()  | 
	
	
	
		
		
			
			 
			
			Error using ==> sumsqr 
		
		
		
		
		
		
		
	Too many input arguments. sumsqr没用对?太多输入参数?  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 |