Solve1 d wave complete the following missing

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: information to use the code!) clear;clc a= ; f= inline(' u0=inline(' v0=inline(' g1=inline(' g2=inline(' L= ; T= ; nx= ; nt= ; ','t','x'); ','t','x'); ','t','x'); '); '); %% Numerical solution: [u1,t,x]=wave(a,f,u0,v0,g1,g2,L,T,nx,nt); %% Analytical solution (is U(i,j)and is given to you. You only need to evaluate in your mesh) % Plot solutions figure(1),clf subplot(1,2,1) mesh(x,t,u1),hold on xlabel('x','fontsize',12,'fontweight','bold') ylabel('t','fontsize',12,'fontweight','bold') zlabel('u(x,t)','fontsize',12,'fontweight','bold') title(['Numerical Solution '],'fontsize',12,'fontweight','bold') subplot(1,2,2) mesh(x,t,U) xlabel('x','fontsize',12,'fontweight','bold') ylabel('t','fontsize',12,'fontweight','bold') zlabel('u(x,t)','fontsize',12,'fontweight','bold') title(['Analytical Solution'],'fontsize',12,'fontweight','bold') function [U,t,x]=wave(a,f,u0,v0,g1,g2,L,T,nx,nt) % Define important parameters % Construct your mesh and matrix of solution points % Compute the solution at t=0 and all x-points % Compute the solution at t=dt and all x-points % Compute the solution at all other times...
View Full Document

This document was uploaded on 02/12/2014.

Ask a homework question - tutors are online