HOW to draw the type of graph in matlab
1 view (last 30 days)
Show older comments
f(x)=k (0<x<pi)
1 Comment
Answers (1)
Star Strider
on 13 Mar 2019
Try this approach, using ‘logical indexing’:
k = 0.1;
f = @(x) k*((0 < x) & (x < pi));
x = linspace(-pi/2, 3*pi/2);
figure
plot(x, f(x))
grid
Experiment to get the result you want.
1 Comment
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!