Solve for the constants of a Quartic given the complex roots?
Hi Johnathan, r = [-5 -6 -9.6+25.7i -9.6-25.7i]; p = poly(r) r1 = roots(p) % check p = 1.0e+04 * 0.0001 0.0030 ...

2 months ago | 0

| accepted

Coding a function for the Fourier Transform.
Hi Anthony, the only problem here is the normalization. For the inverse transform you are dividing by sqrt(N) every time, (N b...

2 months ago | 0

| accepted

Ignoring NaNs for polyfit
Hello TimaMarie, yes, polyfit doesn't like NaNs. One way out is, just before doing polyfit, toss out the elements of both vari...

2 months ago | 0

| accepted

Find first item with a certain condition and use it, instead of finding all items with that condition
Hi Thomas, [After reading comments from Bruno and Rik I realized I forgot to mention that in order to get your code to run I ch...

2 months ago | 1

Fzero returning wrong root
Hello Emily If you insert this F_theta = double(F_theta); just after the calculation of F_theta, you will get the correct res...

2 months ago | 2

| accepted

Solution of differential equations with an input derivative
Hi Pawel, you have e = -x(1) + 1; so de/dt = d/dt(-x(1) + 1) = -dx(1)/dt but dx(1)/dt = (x(2)-x(1))/T2 so you can replace...

2 months ago | 1

| accepted

quat2angle different result
Hi Sven, it's pretty clear that both test and original have discontinuities because the function producing the angles, probably...

2 months ago | 0

WHY ARE THE COLORS OF MY LEGEND ALL MESSED UP?
Hi OI, One reason that Sylvain posted his comment is that you do not provide working code. And of course your odds of getting ...

2 months ago | 1

Why do I get too high dominant frequencies in FFT
Hi Timo, From your attached data I can see that it's 2 sec at 48 kHz as you said. In your frequency plot, the data seems to be...

2 months ago | 0

fitting only continous line
Hi salman, I have been off taking a look at this problem. The method below uses the fact that what you call the discontinouus ...

2 months ago | 0

| accepted

Hi Abdulla, You mention +- 3 as the coefficient, but are using +-6 in the actual example so I will stay with that. Looking at ...

2 months ago | 0

| accepted

Changing the amplitude (y-axis) of an FFT back to units of force.
Hi Kev, The first thing is, the time and frequency arrays have to be correct. You are not actually using the 'time' variable b...

2 months ago | 1

How to avoid an Infinite Loop?
Waseem, Nothing in the entire while loop alters either 'sizes' or 'sizesB'. So if sizes(1) ~= sizesB(1), that condition will ...

3 months ago | 0

Calculation of antenna efficiency
Hi Shahar, The plot is of directivity, not gain (confusingly, directivity is sometimes called directive gain). Since directivi...

3 months ago | 0

| accepted

How can I obtain the mean and standard deviation of a gaussian PDF
Hi Matthew, here is an example, where mu and sigma are calculated by numerical integration. Also shown are analytical results ...

3 months ago | 1

| accepted

Why am I getting Complex number results?
Hello Ethan, The reason for this is that at step i = 14, the quantity on the third to last line, (1-(c*y(i)/T)) becomes negativ...

3 months ago | 1

Poisson Boltzmann eq. with an infinite boundary condition
Hi Roi For convenience I will use u in place of psi. An exact solution is tanh(u/4) = A*exp(-x) where A = tanh(1/4) ...

3 months ago | 1

Can I use the PDEPE solver to solve the following dimensionless Transient PFR PDE? If not, what method do you reconmend?
Hello Rogelio, For psi(t,eta) I assume that the boundary conditions are psi(0,eta) = 0 for all eta an...

3 months ago | 0

double peaks in FFT matlab
Hello hamzah the fft is a complex function. Are you plotting only the real part? This problem is occurring because your delta...

3 months ago | 0

How to plot wavelength and wavenumber FFT from intensity data
Hi Arwi, n = 3648, dpix = 8e-9; % 8nm seems small for a pixel width The x array has spacing delx = dpix and is x = delx*(0:...

3 months ago | 0

Verifying the uncertainty principle with fft for Gaussian
Hello Ori, The problem stems from the following, where I am using t and f rather than x and k (see comment). For an fft, once ...

3 months ago | 0

| accepted

why the Real and imaginary part of fourier transform (fft) are not zero for real odd function
Hi Jiali, with an even number of points the symmetry is not quite right. In the frequency domain, for eight points (without an...

3 months ago | 0

| accepted

How to solve Ax=B with some knowns in x and B
Hi Derek, the method below uses y instead of B so that A*x = y, and does not assume that the known values of x are contiguous t...

3 months ago | 0

Convert permute and reshape to for
Hi Raquel, For loops are going to be slower, but it is interesting to seet how much and under what circumstances. The followin...

3 months ago | 0

| accepted

X axis for convoluted function
Hi dinesh, Here is an example with two normal (gaussian) pdfs. Arrays x and f(x) describe one of them, and arrays y and g(y) d...

3 months ago | 0

¿Why the phase of the Fourier transform whith "angle" fuction of a rectangular pulse function is not odd?
Hi Paulina, neglecting some unimportant (in this context) real constants, the fourier transform of the square pulse is sin(w*t...

3 months ago | 0

RF toolkit capacitance calculation
Hi Derek, The exact expression is indeed the acosh expression used in Matlab, and we would expect no less. The log expression ...

4 months ago | 0

| accepted

How to shuffle data at the same way EVERYTIME random.seed(42)
Hi RG rng(12345) % for example rand rand rng(12345) rand % same values as before rand see help rand for mor...

4 months ago | 0

Inaccuracy in a loglog(...) plot, compared to a standard plot(...)
HI Adam, I am assuming that you are doing something like x = [1 2] y = [2,3] plot(x,y) and then zooming in on the plot at, ...

4 months ago | 3

| accepted