New to MATlab-how to fix '^' error

 Accepted Answer

KSSV
KSSV on 8 Sep 2020
Edited: KSSV on 8 Sep 2020
Read about element by element operations. You have to replace ^ with .^. Error is clear. Apart from .^ you need to use ./.
v = 2 ;
C0 = 1 ;
a = 0.2 ;
x = 10 ;
t = 1:10 ;
C = (C0/2)*erfc((x-v*t))./(2*(0.4*t).^0.5) ;
plot(t,C)

More Answers (0)

Categories

Asked:

on 8 Sep 2020

Edited:

on 8 Sep 2020

Community Treasure Hunt

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

Start Hunting!