MATLAB: Invalid use of operator. “*”

learning

% compute the function y=exp (x2) * cos (20x) in the range x= -2:0.1:2.
clc
close all
x = -2: 0.1: 2;
y = cos(20*x). * exp(x.^2);
plot(x,y)

Best Answer

Make sure the period is adjacent to the asterisk:
y = cos(20*x).* exp(x.^2);
Related Question