Invalid use of operator. "*"

13 views (last 30 days)
Andrew Burns
Andrew Burns on 12 Apr 2020
Answered: Tommy on 12 Apr 2020
% 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)

Accepted Answer

Tommy
Tommy on 12 Apr 2020
Make sure the period is adjacent to the asterisk:
y = cos(20*x).* exp(x.^2);

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!