how to enter function expoential function with two variable
Show older comments
calculate u(x,t)= exp (a*x+b*t)
Answers (1)
Star Strider
on 7 Feb 2016
Write it as an anonymous function, using vectorised operations:
u = @(x,t) exp (a.*x+b.*t);
then provide its parameters and variables, and see what it produces:
a = 5.0;
b = -0.2;
u = @(x,t) exp (a.*x+b.*t);
x = linspace(0,4);
t = linspace(0,2);
[X,T] = meshgrid(x,t);
U = u(X,T);
figure(1)
surf(X, T, U)
grid on
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!