Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to draw piecewise function in MATLAB

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to draw segmented functions in MATLAB, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Recently I saw this:

A piecewise function, so take the time to write an article about the technique of drawing piecewise functions

.

When we first started to learn programming, we all used the: if-else structure. But the vectorization operation in MATLAB gives us another way of thinking (look directly at the code):

T = 0 / 0 / 0 / 0 / 0.001 / 1 / 1

F_c3_2 = (t > 0.5). * cos (80*pi.*t-15*pi) + (t 0.5: will produce a logical vector. The piece greater than 0.5 is 1, and the part less than or equal to 0.5 is 0, so:

* cos (80*pi.*t-15*pi)

The segment with t greater than 0.5 is completed, and the part with t less than or equal to 0.5 is 0.

By the same token:

(t)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report