Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %NUMFLUX
- function val = numflux(rho_i, rho_i_plus_1)
- global rho_max;
- if (rho_i <= rho_max/2 && rho_i_plus_1 <= rho_max/2)
- val=flux(rho_i);
- elseif (rho_i < rho_max/2 && rho_i_plus_1 > rho_max/2)
- A(1,1)=flux(rho_i);
- A(2,1)=flux(rho_i_plus_1);
- val=min(A);
- elseif (rho_i_plus_1 < rho_max/2 && rho_i > rho_max/2)
- val=flux(rho_max/2);
- elseif (rho_i >= rho_max/2 && rho_i_plus_1 >= rho_max/2)
- val=flux(rho_i_plus_1);
- end
- end
- gordonov
- zadanie 2
- for i=1:Nx
- if i<= (Nx/2)
- rho(1,i) = rho_max;
- else
- rho(1,i)=rho_R;
- end
- end
- zadanie 3
- for j=1:Ntraj
- traj(n,j) = traj(n-1,j) + delta_t*u_max*(1-interpolate_rho(traj(n-1,j), rho(n-1,:), xs)/rho_max);
- end
- end
- [XX YY] = meshgrid(xs,ts);
- pcolor(XX,YY,rho);
- shading('interp');
- hold on; plot(traj(:,1), ts', 'w-');
- hold on; plot(traj(:,2), ts', 'r-');
- hold on; plot(traj(:,3), ts', 'b-');
- zadanie 4
- zmienic warunek poczatkowy
- for i=1:Nx
- rho(1,i)=rho_max/2;
- end
- if ((ts(n) >= 1/60 && ts(n) <= 2/60 && xs(i)==-1))
- flux_plus=0;
- elseif (ts(n) >= 4/60 && ts(n) <= 5/60 && xs(i)==0)
- flux_plus=0;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement