Hi, I am new to MATLAB. I am not getting the plot .
Show older comments
I am trying to plot N=5; A=-20:5:20; B=(1/N)*(abs((sin((N*A)/2))/(sin(A/2)))); plot(A,B)
I am not getting any error but getting only one value for B. Help please. Thank You in advance
Accepted Answer
More Answers (1)
Jim Riggs
on 28 Feb 2018
0 votes
Inside the abs function you are dividing two vectors. This is where the error is.
2 Comments
Kshitija Bagde
on 28 Feb 2018
Jim Riggs
on 28 Feb 2018
You should review your Matlab introductory material for operation syntax. Matlab uses different syntax to determine when a matrix operation is to be performed (as you have specified) vs. a scalar operation (as Chad has shown in his answer). You need to be familiar with these concepts.
Categories
Find more on Surfaces, Volumes, and Polygons 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!