Use python Data processing , The code is as follows :

import numpy as np
fs = 5
ts = np.arange(-1,1+1/fs,1/fs)

Found such a mistake :

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ZeroDivisionError: division by zero

Find cause , Found to be python The division rule doesn't make it clear , The correct way of writing should be

import numpy as np
fs = 5.0
ts = np.arange(-1,1+1/fs,1/fs)

python More articles on the precautions of division

  1. Python Division by middle :/ and //

    stay Python in , There are two kinds of division :/ and //. X / Y about Python2.X Come on , If both operands are integers , Then the result will be rounded down ( This and C The difference in it ,C Inside is to 0 integer ), in other words , If it turns out to be -2.5, ...

  2. python Several types of division

    Traditional division : Direct suffix decimal point , The same result is aligned with the largest decimal point >>> 1/2 0 >>> 1.0/2 0.5 >>> 1/2.0 0.5 >> ...

  3. Python in for else matters needing attention

    Suppose you have the following code : for i in range(10): if i == 5: print 'found it! i = %s' % i else: print 'not found it ...' ...

  4. Python Division in

    stay C/C++ The language will divide the integer by the floor ( Take away the decimal part ). for example int a=15/10; a As the result of the 1. The same in Java It's the same with China , So the two one. int When you need to return a floating-point data for data division, you need ...

  5. python Notice in

    .python Medium and Calculate the expression from left to right , If all values are true , Then return the last value , If false , Returns the first false value : or It's also from left to right that there's a computational expression , Returns the first true value : And the numbers 0 It's fake , Everything else is true : word ...

  6. python Medium join.set ,copy And delete the notes :

    1 ,join  :  Stitching objects into a whole in the form of strings for E :  li = [" Li Bai ", " yes ", " Poetry fairy "]    s = & ...

  7. Python Operator in

    Common data types , Let's talk about operators . Operators are used to operate on various types of data , Let static data run . Operations in programming languages are roughly divided into the following categories : Arithmetic operations , For mathematical operations such as addition, subtraction, multiplication and division The assignment operation , Used to receive operators or methods ...

  8. 【python】 What to pay attention to when inheriting

    1. __init__ matters needing attention If the parent class has __init__ function , Subclasses don't have , Then the subclass calls the parent class automatically __init__ function If the parent class has __init__ function , Subclasses also have , Then the subclass must actively call the parent class __init__ function ...

  9. [ Reprint ]python in multiprocessing.pool Function introduction

    Original address :http://blog.sina.com.cn/s/blog_5fa432b40101kwpi.html author : Longfeng Excerpt from :http://hi.baidu.com/xjtukanif/blo ...

Random recommendation

  1. jar Package directory MANIFEST.MF A standard format

    jar Package directory format : |-- com | |-- test.class |-- META-INF | |-- MAINFEST.MF A normal jar There must be META-INF/MANIFEST.MF detailed list ...

  2. ADO.Net Property extension

    Property extension General meaning : When there is a foreign key relationship, the coded information is processed into the original text Such as :Info The nationality column in the table shows the nationality code, which is processed into Nation The names of nationalities in the table Need to be in Info Class to extend a display nation Properties of names using ...

  3. poj3122 pie

    Method : Two points . The title mean : It's birthday , I'll treat you to pie, And then the total number is f+1( myself ). Everyone's pie It can't be spliced , And everyone's area is the same , So we use a binary enumeration . The scope is 0- The biggest one pie. And then use every ...

  4. zookeeper Learning notes (C Language version )

    1.zookeeper brief introduction zookeeper yes Hadoop Subprojects , In large distributed systems ,zookeeper Encapsulate some complex and error prone Services , Provide easy to use interface , To provide users with efficient and stable services . These services include ...

  5. oradebug advance scn

    Sometimes we come across mistakes like the following : ORA-01092: ORACLE instance terminated. Disconnection forced ORA-00600: internal error ...

  6. Mysql Perfect solution to Chinese garbled problem

    MySQL There are no more than the following reasons for garbled Chinese : 1.server Set the problem by itself , For example, still staying in latin1 2.table The problem of language family setting in English ( contain character And collation) 3. Client program ( for example ...

  7. ArcGIS Server 10.0 Installation and use of complete strategy

    introduction ArcGIS Server 10.0 In the process of using and installing , A more comprehensive study is needed , In order to use . Lack of proper guidance , Users are easy to encounter problems in installation and use . So the author here summarizes Server 10.0 Install and make ...

  8. Yes excel File reading

    poi Upload files , Get ready <dependencies><dependency> <groupId>org.apache.poi</groupId> < ...

  9. dom4j analysis xml String instances

    DOM4J And use DOM.SAX.JAXP Mechanism to analyze xml comparison ,DOM4J Better performance , Excellent performance . Powerful and extremely easy to use features , As long as you know DOM Basic concepts , You can go through dom4j Of api Document to parse xml ...

  10. ASP.NET Boilerplate-AbpSession

    /------2016-05-15/------ Introduce If an app supports login , Maybe you need to know some actions of the current login user , However ASP.NET The presentation layer itself provides Session Support for ,ABP Provides IAbpSe ...