Answered

Create block sparse matrix

HI ks, Here is one way. % create a matrix with known elements, not square A = magic(4); A(:,4) = []; n0 = 3; m0 = 5; % ...

Create block sparse matrix

HI ks, Here is one way. % create a matrix with known elements, not square A = magic(4); A(:,4) = []; n0 = 3; m0 = 5; % ...

5 hours ago | 0

Answered

Flatten Matrix in Row Major Order in Arbitrary Dimensions

Hello Lucas-Raphael, I'm not sure this is what you are looking for, but B = permute(A,[6 5 4 3 2 1]); % (however many dim...

Flatten Matrix in Row Major Order in Arbitrary Dimensions

Hello Lucas-Raphael, I'm not sure this is what you are looking for, but B = permute(A,[6 5 4 3 2 1]); % (however many dim...

9 days ago | 0

Answered

Looking for a function f(x,y,z) based on 3 points to calculate interpolated/extrapolated values with a linear relation

HI Appli, This is something Matlab does really well. I assume by 'linear relation' you mean that each point has a value c = a...

Looking for a function f(x,y,z) based on 3 points to calculate interpolated/extrapolated values with a linear relation

HI Appli, This is something Matlab does really well. I assume by 'linear relation' you mean that each point has a value c = a...

9 days ago | 1

| accepted

Answered

Cannot plot Fourier Transform

Hi Reza, If you take a look at X, the result is X = -((pi*w*sign(w))/2 + fourier(cos(4*t)/t^2, t, w)/2)/pi^2 which shows tha...

Cannot plot Fourier Transform

Hi Reza, If you take a look at X, the result is X = -((pi*w*sign(w))/2 + fourier(cos(4*t)/t^2, t, w)/2)/pi^2 which shows tha...

12 days ago | 0

Answered

IFFT integration doesn't match cumtrapz integration

Hi NIk, This is an Interesting problem. Let g be the function and G its integral. If you just want to key in on an improved r...

IFFT integration doesn't match cumtrapz integration

Hi NIk, This is an Interesting problem. Let g be the function and G its integral. If you just want to key in on an improved r...

12 days ago | 0

Answered

Obtain eigenvalue from matrix and known eigenvector

Hi Henry, you can find the indices where x = 0 and cast those entries out of both x and the corresponding rows and columns of A...

Obtain eigenvalue from matrix and known eigenvector

Hi Henry, you can find the indices where x = 0 and cast those entries out of both x and the corresponding rows and columns of A...

14 days ago | 0

Answered

fftshift with even and odd number of data points (scaling the positive and negative frequency axis)

Hi Farooq, [1] For N odd, the frequencies before and after using fftshift (or ifftshift) are as you say: N = 9 example: fo...

fftshift with even and odd number of data points (scaling the positive and negative frequency axis)

Hi Farooq, [1] For N odd, the frequencies before and after using fftshift (or ifftshift) are as you say: N = 9 example: fo...

21 days ago | 1

| accepted

Answered

Getting a smooth curve instead of two linear functions

Hi Arber, This can be done reasonably well by a hyperola whose asymptotes are the two lines in question. The hyperbola of cour...

Getting a smooth curve instead of two linear functions

Hi Arber, This can be done reasonably well by a hyperola whose asymptotes are the two lines in question. The hyperbola of cour...

1 month ago | 2

| accepted

Answered

eigs bug for 0 as lowest eigenvalue in parts of the matlab versions

Hi pl, 2018b does not list 'sa' as an option for eigs, so I am speculating that that 'sa' is legacy. However, compariing 'sa' t...

eigs bug for 0 as lowest eigenvalue in parts of the matlab versions

Hi pl, 2018b does not list 'sa' as an option for eigs, so I am speculating that that 'sa' is legacy. However, compariing 'sa' t...

1 month ago | 0

Answered

Reduce the computional time to calculate the mutilplying two matrixes

Hi Thu, try % N = 1000; % M = 200; Q00 = reshape(Q0,N,N*M); ff = reshape(w'*Q00,N,M)'; This is approximately four times f...

Reduce the computional time to calculate the mutilplying two matrixes

Hi Thu, try % N = 1000; % M = 200; Q00 = reshape(Q0,N,N*M); ff = reshape(w'*Q00,N,M)'; This is approximately four times f...

1 month ago | 1

Answered

sine fit in matlab vs closed-form expressions (linear least squares)

Hi Thales, Before doing the least squares calculation it makes sense to try the less ambitious result of finding the right ampl...

sine fit in matlab vs closed-form expressions (linear least squares)

Hi Thales, Before doing the least squares calculation it makes sense to try the less ambitious result of finding the right ampl...

1 month ago | 2

| accepted

Answered

Replace vector of idexes with values from another vector corresponding to those indexes

Hi Nate, c = b(a) gets it done. a becomes an index vector into the elements of b.

Replace vector of idexes with values from another vector corresponding to those indexes

Hi Nate, c = b(a) gets it done. a becomes an index vector into the elements of b.

1 month ago | 1

| accepted

Answered

Division problems wiht matrix, calculation error

Hi Eduardo, It's quite likely that two of the displayed values for LineInf and LineSup are not what you think they are. The va...

Division problems wiht matrix, calculation error

Hi Eduardo, It's quite likely that two of the displayed values for LineInf and LineSup are not what you think they are. The va...

1 month ago | 0

| accepted

Answered

Audio fft shape is too strange.

Hi eunbae, The code is pretty close. The fft of a real signal has positive and negative frequencies, and what you are seeing a...

Audio fft shape is too strange.

Hi eunbae, The code is pretty close. The fft of a real signal has positive and negative frequencies, and what you are seeing a...

1 month ago | 1

| accepted

Answered

Is It possible create a function that, given an equation, finds the value of the (x) so the two members are equal?

Hi Gianmarco, the two equations aren't coupled, and using fzero on Mp^2 seems to work. In the first equation I multiplied by b...

Is It possible create a function that, given an equation, finds the value of the (x) so the two members are equal?

Hi Gianmarco, the two equations aren't coupled, and using fzero on Mp^2 seems to work. In the first equation I multiplied by b...

2 months ago | 0

Answered

Defining derivatives in ode45

Hello sina, If you turn the diagram around by 180 degrees and then let Ca <--> Cb, you get exactly the same diagram that you st...

Defining derivatives in ode45

Hello sina, If you turn the diagram around by 180 degrees and then let Ca <--> Cb, you get exactly the same diagram that you st...

2 months ago | 1

| accepted

Answered

3d Hemisphere transformation Problem from A to 90 degrees in Z axis to B direction

Hi Musa, In the figure you don't say which axis is which, but I will assume +x axis out of the page toward the viewer, +y axis ...

3d Hemisphere transformation Problem from A to 90 degrees in Z axis to B direction

Hi Musa, In the figure you don't say which axis is which, but I will assume +x axis out of the page toward the viewer, +y axis ...

2 months ago | 1

| accepted

Answered

Binomial simulation decreasing error

Hello LD Using M in place of your i, the binornd(M,p*ones(1,N)) creates N draws from a particular binomial distribution. Thi...

Binomial simulation decreasing error

Hello LD Using M in place of your i, the binornd(M,p*ones(1,N)) creates N draws from a particular binomial distribution. Thi...

2 months ago | 1

Answered

power of blackbody radiation

HI rabindra, The expression has a problem at the first point, lambda = 0. But I1 is so tiny near the origin that you can safel...

power of blackbody radiation

HI rabindra, The expression has a problem at the first point, lambda = 0. But I1 is so tiny near the origin that you can safel...

2 months ago | 0

Answered

Phase shift - different results with pi/2 and 1.570796326

Hi Buli, Although I don't have simulink, I think it is reasonably clear what is going on. I will assume here that -pi/2 is the...

Phase shift - different results with pi/2 and 1.570796326

Hi Buli, Although I don't have simulink, I think it is reasonably clear what is going on. I will assume here that -pi/2 is the...

2 months ago | 2

| accepted

Answered

to find the root of quantum transcendental equation

Hi pl, The boundary condition K*cot((KR) = -k (denoted by bc1 below) is for a wave function that is proportional to sin(KR) in ...

to find the root of quantum transcendental equation

Hi pl, The boundary condition K*cot((KR) = -k (denoted by bc1 below) is for a wave function that is proportional to sin(KR) in ...

2 months ago | 0

| accepted

Answered

Solving inequalities without Symbolic Math Toolbox

Hi Andrik, I'm not sure why you are calling these equations 'inequalities', but if you are looking for a numerical solution to ...

Solving inequalities without Symbolic Math Toolbox

Hi Andrik, I'm not sure why you are calling these equations 'inequalities', but if you are looking for a numerical solution to ...

3 months ago | 0

| accepted

Answered

Circularly exclude elements.

Hi Abhijit, try x = 1:n; x(mod([k-1 k+1]-1,n)+1) = []

Circularly exclude elements.

Hi Abhijit, try x = 1:n; x(mod([k-1 k+1]-1,n)+1) = []

3 months ago | 1

| accepted

Answered

1st element of the 'Amplitude' of a fft function

Hi NIma, As you point out, signal_FFT(1) is the sum of all the X values (or the mean if you divide by the number of points in X...

1st element of the 'Amplitude' of a fft function

Hi NIma, As you point out, signal_FFT(1) is the sum of all the X values (or the mean if you divide by the number of points in X...

3 months ago | 1

| accepted

Answered

Select which legend entries to use depending on data set plotted

Hi Henry, A simple way to do this is, when a trace does not exist, substitute it with nan(1,n) or nan(n,1), keeping the array t...

Select which legend entries to use depending on data set plotted

Hi Henry, A simple way to do this is, when a trace does not exist, substitute it with nan(1,n) or nan(n,1), keeping the array t...

3 months ago | 0

Answered

How to plot a numerical integral using the trapezoidal method

Hi Mahdi, I believe your units are correct, although dividing by D gives normalized conductivity and not absolute conductivity....

How to plot a numerical integral using the trapezoidal method

Hi Mahdi, I believe your units are correct, although dividing by D gives normalized conductivity and not absolute conductivity....

3 months ago | 0

Answered

FFT and IFFT: Random Phases

Hi Nycholas, Assuming signal is real and of length n, n even, then Y(1) is for frequency 0, the DC contribution, and it's real...

FFT and IFFT: Random Phases

Hi Nycholas, Assuming signal is real and of length n, n even, then Y(1) is for frequency 0, the DC contribution, and it's real...

3 months ago | 1

Answered

Difference between x*(1e-n1) == x/(1en2)??

Hi Rob, The difference comes down to rounding of the very last digit in binary representation. It's interesting to use 'format...

Difference between x*(1e-n1) == x/(1en2)??

Hi Rob, The difference comes down to rounding of the very last digit in binary representation. It's interesting to use 'format...

3 months ago | 1

Answered

In the "ex_simrf_adc", there is a 50 Ohm connection with the voltage of 0.1 micro Volt input and it is converted to -142 dBm input and I am not able to get the exact power calculation. Could you please show me?

Hi Charles, I don't have simulink, but to convert from Vrms to dBm, dBm = 10*log10(Vrms.^2/50) + 30; Here Vrms.^2/50 is the p...

In the "ex_simrf_adc", there is a 50 Ohm connection with the voltage of 0.1 micro Volt input and it is converted to -142 dBm input and I am not able to get the exact power calculation. Could you please show me?

Hi Charles, I don't have simulink, but to convert from Vrms to dBm, dBm = 10*log10(Vrms.^2/50) + 30; Here Vrms.^2/50 is the p...

3 months ago | 0

Answered

problem of pdepe!

Hi Junyi, When you made the change, the flux went down by a factor of 1/pi^2. That's fine, but one of your boundary conditions...

problem of pdepe!

Hi Junyi, When you made the change, the flux went down by a factor of 1/pi^2. That's fine, but one of your boundary conditions...

3 months ago | 0