How can I solve the following code?
1 回表示 (過去 30 日間)
古いコメントを表示
% Ekuacioni hiperbolik i lëkundjeve të kordës- metoda Furie,
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]) %grafikon profilin e kordë në mom.t
pause(.001)
end
pause(7)
xp=0.5;
figure(3)
fplot('ztfx',[0 T],'r') %grafikon trajektoren e pikës xp=0.5 të kordës
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?
1 件のコメント
Walter Roberson
2017 年 6 月 7 日
You ask to fplot ztfx but you show us the code for ztf
I notice that your ztf takes two parameters. fplot() is for use with functions that take only one parameter.
回答 (0 件)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!