作业帮 > 综合 > 作业

Matlab程序编写和出图

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/08 20:58:49
Matlab程序编写和出图
u(x,t) = 10 + 5*cos(2*pi*t/T) + (1 + cos(2*pi*t/T))*x/5 + sum{n=1 to
n=N} ( (10/pi*n [(T/2*pi) * sin(2*pi*t/T) - (25/(pi*n))^2 cos(2*pi*t/T)] *
sin(pi*n*x/25) )
I need it once with T=1 and once with T=365.Also for N
you can give any number,like 100,then 200,then 300 and so on.that will
create an animation,t=1000
% 定义符号变量
syms x t
syms T n N


% 函数表达式
u = 10 + 5*cos(2*pi*t/T) + (1 + cos(2*pi*t/T))*x/5 + symsum( (10/pi*n * ((T/2*pi) * sin(2*pi*t/T) - (25/(pi*n))^2 * cos(2*pi*t/T) ) * sin(pi*n*x/25) ), n, 1, N);

% 依次对T和N取不同值绘制曲面
for T1 = [1 365]
for N1 = 100 : 100 : 500
ezmesh( subs(u, {T,N}, {T1,N1}) )
title( sprintf('T = %i, N = %i', T1, N1) ) % 修改图形标题
drawnow % 更新绘图
end
end