I want to plot a function for different values of time
1 次查看(过去 30 天)
显示 更早的评论
This is a function in 2 variable (x,t)
f = (699729515992263*exp(-(3555899736243218994140625*t)/9007199254740992)*cos(20000000*pi*x))/144115188075855872 - (8478402047166467*exp(-(3555899736243218994140625*t)/36028797018963968)*cos(10000000*pi*x))/1152921504606846976 + (4049874448795339*exp(-(3555899736243218994140625*t)/2251799813685248)*cos(40000000*pi*x))/1152921504606846976 - (4758684662903855*exp(-(32003097626188970947265625*t)/36028797018963968)*cos(30000000*pi*x))/1152921504606846976 - (7369322330077077*exp(-(44448746703040240478515625*t)/18014398509481984)*cos(50000000*pi*x))/2305843009213693952 + 1/100 ;
I want to plot the function f(x) for different values of t , for example for x = (0, 1e-6) and for 10 values of t like { 0, 0.001, 0.002, ... 0.01} .
All together in 1 plot. So there may be 10 plots in a single figure.
2 个评论
采纳的回答
the cyclist
2020-3-3
f = @(x,t) (699729515992263*exp(-(3555899736243218994140625*t)/9007199254740992)*cos(20000000*pi*x))/144115188075855872 - (8478402047166467*exp(-(3555899736243218994140625*t)/36028797018963968)*cos(10000000*pi*x))/1152921504606846976 + (4049874448795339*exp(-(3555899736243218994140625*t)/2251799813685248)*cos(40000000*pi*x))/1152921504606846976 - (4758684662903855*exp(-(32003097626188970947265625*t)/36028797018963968)*cos(30000000*pi*x))/1152921504606846976 - (7369322330077077*exp(-(44448746703040240478515625*t)/18014398509481984)*cos(50000000*pi*x))/2305843009213693952 + 1/100 ;
t = linspace(0,0.01,10);
figure
hold on
plot(t,f(0,t))
plot(t,f(1.e6,t))
0 个评论
更多回答(1 个)
David Hill
2020-3-3
Not sure what you are after, but you can try this:
f = @(x,t)(699729515992263*exp(-(3555899736243218994140625*t)/9007199254740992)*cos(20000000*pi*x))/144115188075855872 - (8478402047166467*exp(-(3555899736243218994140625*t)/36028797018963968)*cos(10000000*pi*x))/1152921504606846976 + (4049874448795339*exp(-(3555899736243218994140625*t)/2251799813685248)*cos(40000000*pi*x))/1152921504606846976 - (4758684662903855*exp(-(32003097626188970947265625*t)/36028797018963968)*cos(30000000*pi*x))/1152921504606846976 - (7369322330077077*exp(-(44448746703040240478515625*t)/18014398509481984)*cos(50000000*pi*x))/2305843009213693952 + 1/100 ;
[x,t]=meshgrid(linspace(0,1e-6,10),linspace(0,.01,10));
plot3(x,t,f(x,t));
surf(x,t,f(x,t));
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!