| Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) | 
![]()  | 
	
| 		
			
			 | 
		#1 | 
| 
			
			 初级会员 
			
			
			
			注册日期: 2010-06-02 
				
				
				
					帖子: 2
				 
				
				
				声望力: 0 ![]()  | 
	
	
	
		
		
			
			 
			
			最近学习Matlab里面插值时遇到的问题,以下是我从《Matlab7.0从入门到精通》里抄的段程序: 
		
		
		
		
		
		
		
	clear; x=0:1.2:10; y=sin(x); xi=0:0.1:10; yi_nearest=interp1(x,y,xi,'nearest'); yi_linear=interp1(x,y,xi); yi_spline=interp1(x,y,xi,'spline'); yi_cubic=interp1(x,y,xi,'cubic'); yi_v5cubic=interp1(x,y,xi,'v5cubic'); hold on; subplot(2,3,1); plot(x,y,'ro',xi,yi_nearest,'b-'); subplot(2,3,2); plot(x,y,'ro',xi,yi_linear,'b-'); subplot(2,3,3); plot(x,y,'ro',xi,yi_spline,'b-'); subplot(2,3,4); plot(x,y,'ro',xi,yi_cubic,'b-'); subplot(2,3,5); plot(x,y,'ro',xi,yi_v5cubic,'b-'); 运行完结果显示: ??? Attempt to execute SCRIPT interp1 as a function. Error in ==> test1 at 5 yi_nearest=interp1(x,y,xi,'nearest'); 小弟不知道哪里有问题,请高手指教  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#2 | 
| 
			
			 高级会员 
			
			
			
			注册日期: 2008-11-07 
				住址: 湖南长沙 
				
				
					帖子: 233
				 
				
				
				声望力: 22 ![]()  | 
	
	
	
		
		
			
			 
			
			把函数文件和你的目标文件放同一路径里
		 
		
		
		
		
		
		
			
				__________________ 
		
		
		
		
	坚持就是胜利,努力就有奇迹。  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 |