Question

In: Computer Science

Using the range 0 ≤ x ≤ 1 and 0 ≤ t ≤ 1 make an...

Using the range 0 ≤ x ≤ 1 and 0 ≤ t ≤ 1 make an animated plot of:

1.) y1(x,t)=cos(4πt)sin(πx)

2.) y2(x,t)=cos(8πt)sin(2πx)

using matlab

Solutions

Expert Solution

Solution :

Following are the Matlab code for both the part with output :

a)

%range of x
x=0:0.01:1;
%range of y
t=0:0.01:1;
%given function a)
y=cos(4*pi*t).*sin(pi*x);

curve=animatedline('Color','r','Marker','o');
set(gca,'XLim',[0,1],'YLim',[-1,1]);
grid on;
legend("animated plot 1");
for i=1:length(x)
    addpoints(curve,x(i),y(i));
    drawnow
end

Code demo :

b)

%range of x
x=0:0.01:1;
%range of y
t=0:0.01:1;

%given function b)
y=cos(8*pi*t).*sin(2*pi*x);
curve=animatedline('Color','b','Marker','o');
set(gca,'XLim',[0,1],'YLim',[-1,1]);
grid on;
legend("animated plot 2");
for i=1:length(x)
    addpoints(curve,x(i),y(i));
    drawnow
end

Code demo :


Related Solutions

Please solve the following: ut=uxx, 0<x<1, t>0 u(0,t)=0, u(1,t)=A, t>0 u(x,0)=cosx, 0<x<1
Please solve the following: ut=uxx, 0<x<1, t>0 u(0,t)=0, u(1,t)=A, t>0 u(x,0)=cosx, 0<x<1
x"(t)- 4x'(t)+4x(t)=4e^2t ; x(0)= -1, x'(0)= -4
x"(t)- 4x'(t)+4x(t)=4e^2t ; x(0)= -1, x'(0)= -4
Solve the IVP using Laplace transforms x' + y'=e^t -x''+3x' +y =0 x(0)=0, x'(0)=1, y(0)=0
Solve the IVP using Laplace transforms x' + y'=e^t -x''+3x' +y =0 x(0)=0, x'(0)=1, y(0)=0
Solve the following differential equations: 1. x"(t)+ x(t)=6sin(2t) ; x(0)=3, x'(0)=1 2.y"(t)- y(t)=4cos(t) ; y(0)+0 ,...
Solve the following differential equations: 1. x"(t)+ x(t)=6sin(2t) ; x(0)=3, x'(0)=1 2.y"(t)- y(t)=4cos(t) ; y(0)+0 , y'(0)=1
Solve the Boundary Value Problem, PDE: Utt-a2uxx=0, 0≤x≤1, 0≤t<∞ BCs: u(0,t)=0 u(1,t)=cos(t) u(x,0)=0 ut(x,0)=0
Solve the Boundary Value Problem, PDE: Utt-a2uxx=0, 0≤x≤1, 0≤t<∞ BCs: u(0,t)=0 u(1,t)=cos(t) u(x,0)=0 ut(x,0)=0
utility function u(x,y;t )= (x-t)ay1-a x>=t, t>0, 0<a<1 u(x,y;t )=0 when x<t does income consumption curve...
utility function u(x,y;t )= (x-t)ay1-a x>=t, t>0, 0<a<1 u(x,y;t )=0 when x<t does income consumption curve is y=[(1-a)(x-t)px]/apy ?(my result, i used lagrange, not sure about it) how to draw the income consumption curve?
Solve the following differential equations: 1.) y"(x)+ y(x)=4e^x ; y(0)=0, y'(0)=0 2.) x"(t)+3x'(t)+2x(t)=4t^2 ; x(0)=0, x'(0)=0
Solve the following differential equations: 1.) y"(x)+ y(x)=4e^x ; y(0)=0, y'(0)=0 2.) x"(t)+3x'(t)+2x(t)=4t^2 ; x(0)=0, x'(0)=0
y''(t)+(x+y)^2*y(t)=sin(x*t+y*t)-sin(x*t-y*t), y(0)=0, y'(0)=0, x and y are real numbers
y''(t)+(x+y)^2*y(t)=sin(x*t+y*t)-sin(x*t-y*t), y(0)=0, y'(0)=0, x and y are real numbers
Solve the nonhomogeneous heat equation: ut-kuxx=sinx, 0<x<pi, t>0 u(0,t)=u(pi,t)=0, t>0 u(x,0)=0, 0<x<pi
Solve the nonhomogeneous heat equation: ut-kuxx=sinx, 0<x<pi, t>0 u(0,t)=u(pi,t)=0, t>0 u(x,0)=0, 0<x<pi
Take the Laplace transform of the following initial value and solve for X(s)=L{x(t)}X(s)=L{x(t)}: x′′+16x={sin(πt),0} 0≤t<1 1≤t...
Take the Laplace transform of the following initial value and solve for X(s)=L{x(t)}X(s)=L{x(t)}: x′′+16x={sin(πt),0} 0≤t<1 1≤t x(0)=0 x′(0)=0. a) X(s)=   Now find the inverse transform to find b) x(t)= Use u(t−a) for the Heaviside function shifted a units horizontaly.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT