Clear Filters
Clear Filters

How to create a mask for the area under a cosine curve?

3 views (last 30 days)
HI all
I have created a cosine curve on my image (199 rows x 144 columns). I would like to only retain the values under the curve so that the values above the curve becomes NaNs. How do I do that? For example, how can I create a mask array to get 1s as elements below that curve and 0 or NaN above that curve?
This is my code I used for getting the curve:
t = 0:0.001:1000;
x = 90*cos(1/(23)*t)+110;
hold on;plot(t,x,'linewidth',2);
axis([1, 144, 1,199])
Any help is highly appreciated. Thank you!

Answers (0)

Community Treasure Hunt

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

Start Hunting!