Answered
Ignoring extra legend entries?
Hello Charlotte, you should be getting a pretty strange graph right now, since it would be plotting x vs y1 and then y2 vs y3. ...

9 years ago | 1

| accepted

Answered
Matrices in a matrix
Hi UGO, should your top row read R11, R12, R13? at any rate, try z = zeros(size(A)); C = [A z z;z A z;z z A]; B = C...

9 years ago | 0

| accepted

Answered
How can I get the 3d coordinates of a point by having its distance to some other points with known coordinates?
Hello payman, here is one way to accomplish this. There are always two solutions, given by the two row vectors s, which are re...

9 years ago | 0

Answered
Diagonally dominant matrix with high condition number
Hello othello, yes. a = [2e5 .1; .1 1]; cond(a) ans = 2.0000e+05

9 years ago | 1

Answered
Why do I get a different Phase graph, when using FFT versus hand calculations?
Hello Peter, This is pretty close and it definitely helps that it was complete working code. There are just a couple of thin...

9 years ago | 1

| accepted

Answered
creating random dense symmetric matrix with desired condition number
[modified to address the first comment below] Hi othello, I don't know about built-in functions but there are ways to make y...

9 years ago | 1

Answered
In for loop, add same fractional value to all non-integers in the vector
HI balsip, try for i = 1:length(A)

9 years ago | 0

| accepted

Answered
Finding the tan inverse for different range of values
Hello AK, consider the following two situations, where all phi obey -pi<angle<pi : case x phi1x = pi - pi/20 phi...

9 years ago | 0

Answered
Fast method count unique variables
Revised answer. For a 7e6 x 30 matrix this takes about 2.7 sec on my PC. m8 = uint8(m); u1 = uint8(1); ncol = size(m...

9 years ago | 0

| accepted

Answered
Correct reasoning of error propagation?
Hi Nicki, First off, you only see the values of h rounded to four decimal places. You can help your cause quite a bit by using...

9 years ago | 1

Answered
Numerical Methods to solve Equation
Hi Razi, the usual procedure is to use the 'break' condition start with a value (an initial value may or may not be needed...

9 years ago | 0

| accepted

Answered
fft function returns NaN from non-NaN input
Hi Yuwei, you did check for NaNs but not for any values that equal +-infinity, and there are three of them: >> find(isinf(...

9 years ago | 3

| accepted

Answered
How can i solve this problem ?
Hello Razi, The problem occurs in the statement x(i+1) = (3*x(i)+0.5)^(1/3) The (3x+1/2) part is negative for x <...

9 years ago | 0

| accepted

Answered
How to specify the colors within a colorbar
Hi Carolyn, All you need do is change the colormap line to colormap(sort(Color, 'descend')); but make sure that you ha...

9 years ago | 1

| accepted

Answered
weird rounding error?
Yes, it's interesting that for some tasks such as addition and subtraction of quantities with a fixed number of decimal digits, ...

9 years ago | 0

Answered
How to take advantage of the TRIANGULAR structure of a matrix when solving a linear system involving it?
Hello Joao, if you go to 'doc \' you can see an overview of backslash. The algorithm checks for triangularity right at the beg...

9 years ago | 0

Answered
weird rounding error?
Hi Jason, this is just Computer Science 101. Since computers have only so many bits to describe floating point numbers, there ...

9 years ago | 0

| accepted

Answered
Fixed-displacement pump friction torque vs pressure gain coefficient
Hi Tom, If you convert units from cm^3/rev to m^3/rad, then the value itself picks up a factor of 1e-6/(2*pi) = 1.5915e-07, an...

9 years ago | 0

Answered
How do I convert a 3D RGB image to a grayscale image using the intensity formula (intensity=0.2989*red + 0.5870*green + 0.1140*blue)?
Hi Janel, Given your first three lines that define red green and blue, if you just take the appropriate sum of those as in your...

9 years ago | 1

| accepted

Answered
Formula not returning array
Hello Ian, you forgot to put a dot in front of the divide sign: ./ in order to create element-by-element division.

9 years ago | 0

| accepted

Answered
I am stuck in a question
Hello Arslan, (I checked this by ode45 but the principle should be the same). You are solving dy/dt = (1-y)*exp(-.1*y). For a...

9 years ago | 0

Answered
How to generate mixed exponential distribution random number using the command in MATLAB?
Hello Noor, The function below agrees with the function cited above for several choices of parameters that I have tried. For 1...

9 years ago | 0

Answered
Double Integral using Integral2 Error
Hi jack, I believe this is occurring because your definition of myfun_eqn8 uses the two variables z,phi, but the integrand m1.*...

9 years ago | 1

Answered
Can I find the inverse of a sparse matrix faster?
Hi Staf, Before attempting something as large as T = 2000 it's never a bad idea to try the same thing for T just a bit smaller,...

9 years ago | 0

Answered
Construct phase spectrum before IFFT
Hi Roderick, I see that what I said about dividing your angles by a factor of 2*length(...) was incorrect because that factor w...

9 years ago | 2

| accepted

Answered
How to stop a graph going below zero in
Hello Matui, several ways to do this. If you want to keep the x and y arrays the same length as they are, you could use the fi...

9 years ago | 0

| accepted

Answered
How to pull values out of a matrix using another matrix?
Hello Tudor, Here is one way: indx = find(matrix1==0) matrix2(indx) = 0 This works because 'find' looks at the eleme...

9 years ago | 0

Answered
Spectrum of fm modulaton
Hello AbdAlla, The generation of a real fm signal is not a linear process, but there is no problem with finding the resulting s...

9 years ago | 4

| accepted

Answered
Recursive function for replacing multiple for loops
Hello Ameer, suppose you have d for loops, which means d independent variables i,j,k, ... then your expression reduces to p^d...

9 years ago | 1

| accepted

Answered
Element wise mean produces an incorrect result
hello manuel, What's going on is that for whatever reason, the sum in the third dimension of all your slices equals zero within ...

9 years ago | 0

| accepted

Load more