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.

采纳的回答

the cyclist
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))

更多回答(1 个)

David Hill
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));

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by