clc;clear;close all
global a L H xp tp
a=1; L=1; H=0.02;
T=5; m=10; N=50;
x=linspace(0,L,m+1); t=linspace(0,T,N+1);
[xx,tt]=meshgrid(x,t);
u=ztf1(xx,tt);
figure(1)
surf(xx,tt,u);
pause(7)
figure
dt=0.05;
for t=0:dt:T
tp=t
figure(2)
fplot('ztfx',[0 1])
axis([0 1 -0.5 0.5])
pause(.001)
end
pause(7)
xp=0.5;
figure(3)
fplot('ztfx',[0 T],'r')
The function is
function u=ztf(x,t)
global a L H
NT=100;
s=0;
for n=0:NT
c=(2*n+1)*pi/L;
un=1/(2*n+1)^3*sin(c*x).*cos(a*c*t);
s=s+un;
end
u=32*H/pi^3*s;
however I am not being able to get the function plots . I get constantly these errors: Warning: Error updating FunctionLine.
The following error was reported evaluating the function in FunctionLine update: Undefined function or variable 'xp'. even though xp is defined. So how do I solve this?