Hot answers tagged

69

Other answers haven't yet hit upon what makes e special: defining the time constant as the time required for something to drop by a factor of e means that at any moment of time, the rate of change will be such that--if that rate were continued--the time required to decay to nothing would be one time constant. For example, if one has a 1uF cap and a 1M ...


49

It's built into the mathematics of exponential decay associated with first-order systems. If the response starts at unity at t=0, then after one "unit of time", the response is \$e^{-1} = 0.36788\$. When you're looking at a risetime, you subtract this from unity, giving 0.63212 or 63.2%. The "unit of time" is referred to as the "time constant" of the system,...


36

A divider maps much less elegantly to typical hardware. Take Lattice ICE40 FPGAs as examples. Let us compare two cases: this 8x8 bit to 16 bit multiplier: module multiply (clk, a, b, result); input clk; input [7:0]a; input [7:0]b; output [15:0]result; always @(posedge clk) result = a * b; endmodule // multiply and this divider that ...


32

Complex numbers are similar to vectors, but have some extra mathematical properties that make them useful. Most notably, using the complex exponential \$e^{j\omega t}\$ instead of sines and cosines makes differential equations much easier to deal with. That's how you get to complex impedance in the first place: $$v(t) = A\mathrm e^{\mathrm{j} \omega t + \...


30

Typically high resolution sin(x) functions would be implemented with a CORDIC (COrdiate Rotation DIgital Computer) algorithm, which can be accomplished with a small number of iterations using only shifts and add/subtract and a small lookup table. The original paper The CORDIC Computing Technique by Jack Volder is from 1959. It also works nicely when ...


19

These calculations are absolutely used by professional EEs, for some on a daily basis. However, for many this job has been given to simulation software, such as LTSpice, which is also used on a daily basis. Generally the simulation is much faster to complete, so it is much more productive than doing the calculations by hand. I generally use the formulas ...


18

Only a sketch of a solution. Take all 3 axes into consideration. Acceleration due to gravity, regardless of tilt, will always be 1G, as a vector sum of X,Y,Z, no matter what the tilt. You can picture the acceleration at rest or steady motion as a point on a sphere with radius 1G. (If you are perfectly horizontal, that point will be (0, 0, -1) i.e. directly ...


16

Ohm's law $$ 1: V(t) = I(t)R $$ Instantaneous power dissipation is product of voltage and current $$ 2: P(t) = V(t)I(t)\\ $$ Substitute 1 into 2 to get instantaneous power through a resistor in terms of voltage or current: $$ 3: P(t) = I^2(t)R = \frac{V^2(t)}{R}\\ $$ Average power is definitionally the integral of instantaneous power over a period, ...


16

The error is in the assumption the I2 = I1. The OpAmp can (in general) sink and source current. When it would be sourcing current, this current would have to go to ground, either through R2 or through R1 (less likely). The current through R2 returns to Vx as well as to the negative power terminal of the source that sources the OpAmp. Note you cannot omit ...


14

Most computer trig libraries are based on polynomial approximations, which gives the best balance between speed an accuracy. For example, a dozen or so multiplication and add/subtract operations is enough to give full single-precision accuracy for sine and cosine.


13

In order to how much cap to use where, you need to know a fair bit about capacitors in general: The different types (electrolytic, film, ceramic, tantalum, OS-CON, metalized film, etc.) Their characteristics (impedance, ESR, ESL, polarity, temperature rise, dielectric, etc.) Their failure modes (aging, over voltage, reverse voltage, thermal runaway, etc.) ...


13

Assume the system is already precharged and operating in a steady state. The bridge has two discrete states: either the capacitor is charging (a diode pair is forward biased), or the capacitor is discharging. Call the period P, the charge time DP, and the discharge time (1-D)P. During the charge cycle, we can approximate the current entering the capacitor ...


13

I assume for "high speed" you mean a small delay from data collection to the resultant FFT. With a low sample rate, your computational ability isn't the limiting factor, given modern computers. The delay problem lies in having enough data for analysis. If you want your 1Hz bin to be different from DC/0Hz, you have to accumulate enough signal data to capture ...


13

You refer to these basic formulae at first and then find the real world has a lot of non-linear characteristics like XOR phase detectors in a second PLL loop response when you exceed the phase limit or that all Low Pass filters cause Inter-Symbol-Interference (ISI) unless the filter resonates within the binary symbol then you apply "Raised Cosine" Filters ...


13

Why are complex numbers used and not Vectors? simply because there is no vector division defined in vector algebra, so simply you cannot use Ohm's law in division form, thereby making calculations more complicated. On the other hand the domain of complex number athematic has more progressed over time than vector counterpart, so you have many theorems at ...


12

I haven't done this for double precision FP, but the same principles apply as for single precision, for which I have implemented division (as multiply by reciprocal). What these FPGAs do have, instead of FPUs, is hardwired DSP/multiplier blocks, capable of implementing a 18*18 or (Virtex-5) 18*25 multiplication in a single cycle. And the larger devices ...


12

This is not a compiler issue: doing the division first here is legal behaviour. (Also, when in doubt: use parentheses. There's no penalty.) You are working with integers, so reading / 0xFFFF will always return 0 if reading is a uint16_t unless reading == 0xFFFF. If you want to use integers, force the multiplications to be done first by using something like (...


11

The Laplace variable \$s\$ relates to Fourier's \$j\omega\$ as follows: $$ s = \sigma + j\omega $$ Fourier transform can be seen as a Laplace transform when \$\sigma=0\$. The \$\sigma\$ allows the Laplace integral transformation to converge for signals that Fourier transform does not, e.g. a unitary step (Heaviside function). If you are working with real ...


11

If you can only take measurement at discrete times, then summing up and dividing by the time between measurements is the only way possible – the integral $$E_\text{total}=\int\limits_{T_\text{start}}^{T_\text{end}} P(t) dt$$ really collapses to a sum, it \$P(t)\$ is only known for set of points. For example, assume the power value is constant for amount ...


11

One usually needs to acquire multiple samples per waveform period to get good results from an FFT. The Nyquist limit of 2 samples per period is a lower bound but usually 10 samples per period or more is what is practically used. So to analyze a 64Hz signal you probably want to acquire samples at a rate of 640Hz or more. Also (up to a point) you will get ...


11

The decay of an RC parallel circuit with capacitor charged to Vo v(t) = \$Vo(1-e^{-t/\tau})\$ , where \$\tau\$ is the time constant R\$\cdot\$C. So v(\$\tau\$)/Vo is approximately 0.63212055882855767840447622983854 In other words, the time constant is defined by the RC product (or L/R ratio), and the seemingly arbitrary voltage is a result of that ...


11

The standard C library is providing the optimized solutions for many problems with considerations based on the architecture, compiler in use and others. The abs() function defined in stdlib.h is one of these, and it is used for your purpose exactly. To emphasize the point, here is ARM compiler result when using abs vs a version of a homebrew abs: https://arm....


11

Just to remark on that you can represent impedance as a matrix: $$ R + \mathrm j X \leftrightarrow \begin{bmatrix} R & X \\ -X & R \end{bmatrix} $$ This is in fact the matrix representation of complex numbers. On the other hand you can represent sinusoidal signals (but not impedance) using vectors: $$ x_{\cos} + \mathrm j x_{\sin} \...


10

We can have multiple layers of logic per clock cycle but there is a limit, exactly how many layers of logic we can have an how complex those layers can be will depend on our clock speed and our semiconductor process. However, there are many different multiplication algorithms, and I don't have a clue which one may be used by microcontrollers Afaict most ...


10

This is a fundamental C issue: you need to be extremely clear whether you're doing integer or floating-point arithmetic. uint16_t temperature = reading*0.076295; That promotes "reading" to "float", because 0.076295 is a float literal, then does the multiplication. uint16_t temperature = reading/0xFFFF*2.5*1000*2; The first two elements ...


9

ECL is both the fastest logic family and has the simplest internal structure of modern logic families, but like other bipolar-only families it has a not insignificant power draw. It is also incompatible with other logic families due to its signal voltages. If you're looking for a logic family for general use, my recommendation would be the 74LVC CMOS family....


9

Both sin and cos are considered sinusoidal waveforms. As a practical matter, sin and cos are essentially the same thing, just offset by 90 degrees.Since "time 0" is arbitrary, the distinction between sin and cos only matters if you are comparing phase against another signal. Since Euler's equation works out to cos for the real component and sin for the ...


9

Slow division is inherently iterative so it tends to take longer. There are somewhat faster slow division algorithms than the simple ones, using lookup tables. The SRT algorithm produces two bits per cycle. An error in such a table was the cause of the infamous Pentium FDIV bug (ca. 1994). Then there are so-called fast division algorithms. Of course, in ...


9

Your main mistake is in not treating acceleration as a single vector. When the car is at rest, that vector will always be 1 g upwards. Don't look at just the X component of the raw accelerometer data. Do the real vector math. But my problem is that when the device is on tilt (0g when no tilt) the acceleration is between (downward) 0g->-1g or between (...


9

Aren't you both wrong? To me this sounds like arguing that if someone thinks in English then their neurons are wired in English, which is nonsensical. If you actually want to force application of the terms then I think it is just a matter of perspective. For example, an assembly instruction (or machine code) might tell a CPU to add. From the perspective of ...


Only top voted, non community-wiki answers of a minimum length are eligible