Plotting complementary error function with 2 variables

I am tryimg to plot complementary error function for two variables but it keeps giving me empty figure. Here is my code:
T0 = 100;
T1 = 70;
c = 1;
u = @(x,t) (T0-T1)*erf(x./(2*c*sqrt(t)))+T0;
fsurf(u)

Answers (2)

T0 = 100;
T1 = 70;
c = 1;
x = linspace(-1,1) ; % define your range
t = linspace(0,10) ; % define your range
[x,t] = meshgrid(x,t) ;
u = (T0-T1)*erf(x./(2*c*sqrt(t)))+T0;
surf(x,t,u)

2 Comments

but my x is and t are defined as x > 0 and t > 0 when I put linspace(0,inf) it also give empty graph
You need to provide some upper limit.....with this you cannot plot.

Sign in to comment.

T0 = 100;
T1 = 70;
c = 1;
t = linspace(1,10,20);
syms x
u = (T0-T1)*erf(x./(2*c*sqrt(t)))+T0;
fplot(u,[1 10])
you can try using fplot function

Asked:

on 7 Nov 2022

Edited:

on 7 Nov 2022

Community Treasure Hunt

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

Start Hunting!