Unformatted text preview: %For loop to recursively compute the solution. for i = 1:x_d for j = 0:1000 sum_t(i) = sum_t(i) + (sin(((2*j+1)*x(i))-((2*j +1)^3)*t)/(2*j+1)); end end %For loop to compute the final solution. for k = 1:x_d result(k) = .5 - (2/pi)*sum_t(k); end plot(x,result); % Plot the solution xlabel('x ','FontSize',14); % Labeling the ‘x’ axis ylabel('u(t,x)','FontSize',14); % Labeling the ‘y’ axis title('Solution to the linearly dispersive wave equation','FontSize',14);% Providing the title to the graph....
View Full Document
This note was uploaded on 11/19/2011 for the course MATH 101 taught by Professor Wormer during the Spring '08 term at UCSD.
- Spring '08