error when plotting function

1 view (last 30 days)
Gavin Seddon
Gavin Seddon on 22 Nov 2016
Commented: Gavin Seddon on 23 Nov 2016
hello, when i give this function i get the following error will someone please correct me ?
>> fplot(@(a1*sin(b1*x+c1) + a2*sin(b2*x+c2) + a3*sin(b3*x+c3) + a4*sin(b4*x+c4),[0,4000]) fplot(@(a1*sin(b1*x+c1) + a2*sin(b2*x+c2) + a3*sin(b3*x+c3) + a4*sin(b4*x+c4),[0,4000]) ↑ Error: Unexpected MATLAB operator.

Accepted Answer

Torsten
Torsten on 22 Nov 2016
Did you read the documentation ?
a1=...;
a2=...;
a3=...;
a4=...;
b1=...;
b2=...;
b3=...;
b4=...;
c1=...;
c2=...;
c3=...;
c4=...;
fplot(@(x)(a1*sin(b1*x+c1) + a2*sin(b2*x+c2) + a3*sin(b3*x+c3) + a4*sin(b4*x+c4),[0,4000])
  1 Comment
Gavin Seddon
Gavin Seddon on 23 Nov 2016
your command failed due to missing bracket. however now this produces a chaotic graph rather than a function will you help? i have been using matlab help, where should i look >> fplot(@(x)(a1*sin(b1*x+c1) + a2*sin(b2*x+c2) + a3*sin(b3*x+c3) + a4*sin(b4*x+c4)),[0,4000])

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots 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!