Added Group Members, Tested Matlab
This commit is contained in:
		
							parent
							
								
									c05ea06703
								
							
						
					
					
						commit
						2d224ce7ea
					
				
							
								
								
									
										4
									
								
								Exercise_03/Group Members.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								Exercise_03/Group Members.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | |||||||
|  | 12134931, Biancchi Riccardo | ||||||
|  | 01128052,Kapla Daniel Benjamin | ||||||
|  | 01630056, Kuen Jakob | ||||||
|  | 01620740, Müller David | ||||||
							
								
								
									
										44
									
								
								Exercise_03/NSSC_3.asv
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								Exercise_03/NSSC_3.asv
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,44 @@ | |||||||
|  | %% exercise number 2 | ||||||
|  | %problem characteristics | ||||||
|  | U=0.7;%convection velocity | ||||||
|  | delta_x=0.01; %space discretization  | ||||||
|  | L=1; %max length of our domain | ||||||
|  | T=1; %max time considered | ||||||
|  | 
 | ||||||
|  | N=L/delta_x; %number of intervals in space | ||||||
|  | K=100; %number of intervals in time | ||||||
|  | 
 | ||||||
|  | %two initial conditions | ||||||
|  | square_pulse=@(x) heaviside(x-0.1) - heaviside(x- 0.3);  | ||||||
|  | gauss_signal=@(x) exp(-10*(4*x - 1).^2); | ||||||
|  | 
 | ||||||
|  | [x,t,c] = UW_scheme(L,N,T,K,U,square_pulse); | ||||||
|  | ex_sol=@(x,t) square_pulse(x-U*t); | ||||||
|  | f1=figure(1); | ||||||
|  | set(f1, 'Position', [10 10  height]); | ||||||
|  | for ii=1:K+1 | ||||||
|  |     clf(f1) | ||||||
|  |     hold on  | ||||||
|  |     plot(x,c(:,ii)','-bo'); | ||||||
|  |     plot(x,ex_sol(x,t(ii))); | ||||||
|  |     hold off | ||||||
|  |     legend("aproximated solution","exact solution") | ||||||
|  |     xlim([0 L]) | ||||||
|  |     ylim([0 1.1])   | ||||||
|  |     pause(0.02); | ||||||
|  | end | ||||||
|  | 
 | ||||||
|  | [x,t,c] = UW_scheme(L,N,T,K,U,gauss_signal); | ||||||
|  | ex_sol=@(x,t) gauss_signal(x-U*t); | ||||||
|  | f2=figure(2); | ||||||
|  | for ii=1:K+1 | ||||||
|  |     clf(f2) | ||||||
|  |     hold on  | ||||||
|  |     plot(x,c(:,ii)','-bo'); | ||||||
|  |     plot(x,ex_sol(x,t(ii))); | ||||||
|  |     legend("aproximated solution","exact solution") | ||||||
|  |     xlim([0 L]) | ||||||
|  |     ylim([0 1.1])   | ||||||
|  |     pause(0.02); | ||||||
|  | end | ||||||
|  | 
 | ||||||
| @ -15,6 +15,7 @@ gauss_signal=@(x) exp(-10*(4*x - 1).^2); | |||||||
| [x,t,c] = UW_scheme(L,N,T,K,U,square_pulse); | [x,t,c] = UW_scheme(L,N,T,K,U,square_pulse); | ||||||
| ex_sol=@(x,t) square_pulse(x-U*t); | ex_sol=@(x,t) square_pulse(x-U*t); | ||||||
| f1=figure(1); | f1=figure(1); | ||||||
|  | set(f1, 'Position', [100 100 1500 1500]); | ||||||
| for ii=1:K+1 | for ii=1:K+1 | ||||||
|     clf(f1) |     clf(f1) | ||||||
|     hold on  |     hold on  | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Moonwalker777
						Moonwalker777