Answered
finding the maxima/minima using lagrange mutlipliers
Hi Ikenna, Here is one way. If you plot the function on the ellipse th = linspace(0,2*pi,1000); xx = cos(th); yy = sin(th)/...

4 meses ago | 0

| accepted

Answered
Unitary matrix with non-orthogonal eigenvectors?
Hi Joshua, I believe this happens because W has at least one set of degenerate eigenvalues, and does not happen if all the eige...

4 meses ago | 0

Answered
Complex output after applying inverse fourier transform
Hi Brian, I beleive the result is due to asymmetric truncation of the image in the frequency domain. I am inferring that your ...

4 meses ago | 0

| accepted

Answered
Split array into subarrays
Hi David, if A is 200x1 the easiest way to do that is B = reshape(A,50,4) so now B is a matrix whose four columns are each 50...

5 meses ago | 1

Answered
How solve this problem in Matlab
Hi Davide, here is a method that uses one for loop instead of two: n = 5 m = 6 V = zeros(n,m); V(:,1) = 1:n; for k = 2:m ...

5 meses ago | 0

Answered
trigonometric equation solution help
Hi Giuseppe Although Matlab can't come up with an analytic solution with symbolics, you can still obtain a numerical solution t...

5 meses ago | 0

Answered
Efficient way of performing operation on array after performing cumsum
Hi Valentina, A = [1 2 3; 4 5 6; 7 8 9]; B = cumsum(A,2); C = (1:3).\B This gives the result that you show in your question....

5 meses ago | 1

Answered
Finding peak value of distorted sine wave signal with varying phase shift of harmonics
Hello Haroon, This answer addresses the first part, getting a maximum or "minimum-at-maximum" value. It's a lot easier to do t...

5 meses ago | 0

Answered
How to use syms to solve system of equations?
Hi NIcholas, This can be done without using syms. Syms of course can be slow, and the result in this case is a typically ponde...

5 meses ago | 2

Answered
How can I obtain the analytical expression (polynomial) of the spline curve from a curve fitting?
Hi Radu, x = 1:10; y = sin(x).^3; a = interp1(x,y,'spline','pp') a = struct with fields: form: 'pp' br...

5 meses ago | 0

| accepted

Answered
sum of a sum of a sum of a sum
Hi Marta, The code below does not address the algebra in the paper, but I am posting this because it is another way of doing th...

5 meses ago | 1

| accepted

Answered
How can I define proper frequency domain of FFT function in Matlab
Probably a bit late in the game, but the followiing code shows the peak at 300Thz. A couple of issues here: first to (a) get a...

5 meses ago | 0

Answered
Best way to get rid of/ prevent function from creating complex numbers?
Hello Jeffrey, Deleting unsatisfactory results is of course not a good way to deal with this. I ran case {15} from your matfil...

5 meses ago | 1

Answered
Can I input data with multiple column lengths into one matrix?
Hi Brice, If you preallocate as you mentioned then you can insert each column with t = zeros(300,numslugs); x = zeros(300,num...

5 meses ago | 0

Answered
Trying to plot a frequency response (magnitude and angle) using the equation of a forced vibration
Hi Bryanna, The problem statement asks for delta_t of .01, but you have .1 instead. Changing to .01 makes things clearer. The...

5 meses ago | 1

Answered
How do I get rid of certain values with the same X-axis value in a certain range?
Hi Michael, here is one way, assuming that x (many values of which are repeated) and y are two columns. tol = 10; a = polyfit...

6 meses ago | 0

| accepted

Answered
MATLAB and LAPACK implementation of the SVD algorithm - not the same output?
Hi Danijel, actually it's the columns that have different signs. That's for the following reason: Suppose the svd of the matr...

6 meses ago | 0

Answered
I need help with a Triple Integral
Hi Francisco. this is really just a 1d integral. Since nothing depends on theta, the theta integration instantly gives an over...

6 meses ago | 0

Answered
convolution product calculater impulse response
Hi amjad, You have to keep the indices within the bounds set by dx and dh. For the j loop, you can use the line for j=max(1,i...

6 meses ago | 0

| accepted

Answered
Why is the magnitude spectrum spreaded over certain frequency range instead of line spectrum in FFT?
Hi lekhani, The spread is happening because you don't have a pure, CW, constant-amplitude cosine wave in the time domain. That...

7 meses ago | 0

| accepted

Answered
How to determine the lag angle between two snine wave
Hi Hassan Consider the complex wave exp(i*(w*t+theta)) = cos(w*t+theta) + i*sin(w*t+theta) While it's true that the cos a...

7 meses ago | 0

Answered
Yellow Colormap on contour lines
Hello Juan using: doc colormap will bring up all of the preconstructed choices. In this case it looks like 'hot' was used. 'a...

7 meses ago | 0

Answered
I am trying to find values of four constants from four equations. Yet the code is unable to give out values
Hi Sahir, you have to load this beam in some manner in order to get nonzero deflection. If all the boundary conditions are set...

7 meses ago | 0

Answered
What is this fft code doing?
Hi kcee, The code (I'll refer to it by line below) is not doing what it is doing very well. Let's start with the good part, th...

7 meses ago | 0

Answered
How to approximate a triple integral over a rotated grid?
Hi Oscar, Before the cyinder is tilted, you are describing the volume with cylindrical coordinates and finding the moment of in...

7 meses ago | 0

| accepted

Answered
How to plot the subplots but with less lines of code?
HI muhammed all you need to do is put the subplots into a for loop and change the things that vary with subplot. That is the d...

7 meses ago | 1

| accepted

Answered
I have code which calculates the electric potential due a single charge. The results are concentric circles (Correct results) but don't match the theoretical data
Hi Matthew, probably a bit late to be answering this now, but thanks to some editing done by John Kelly at Mathworks it provide...

7 meses ago | 0

Answered
Huffman Dictionary, error with index exceed when i give specific probabilities.
Hi Rafael, sum(probabilities) ans = 1.0003 SInce the probabilities don't add up to 1, the code is going to have problems. ...

7 meses ago | 1

| accepted

Answered
roots of 3*3 matrix determinant
Hi Cern, I assume you mean the three values of w that give a 0 determinant. Eig works for this. K = rand(3,3) c = diag([12 2...

7 meses ago | 0

| accepted

Answered
LDL does not support complex symmetric matrices
Hi Nathan, the LDL decomposition works for hermitian matrices. In LDL the D matrix is hermitian, so if A = L*D*L', then A' ...

7 meses ago | 1

Load more