Beantwortet
Accelerate Matlab calculation for multi-dimension matrix
As you have written your code, A is a 2D array and yet you have taken four successive sums, which makes no sense. Either you me...

etwa 10 Jahre vor | 0

Beantwortet
How to select the particular value and store ias a variable?
r = rand; t1 = (y>=r); t2 = (y<=r); if any(t1) [~,i1] = min(y(t1)); if any(t2) [~,i2] = max(y...

etwa 10 Jahre vor | 0

Beantwortet
Can't find the MATLAB error
There should be a comma between \n' and max(waketime(:)).

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
Image pixels value exceeds 0-255 range, after arithmetic operations on image - How to solve it
I would suggest normalizing the matrix: I = double(I).^3; I = floor(I/max(I(:)));

etwa 10 Jahre vor | 0

Beantwortet
decimal to fraction conversion
The 'rat' function returns with an output in the form of continued fractions. To see it as a single fraction, use "format rat"....

etwa 10 Jahre vor | 5

Beantwortet
How can I use the multidimensional index returned by max or min?
There is a fairly obvious method using nested for-loops, so I assume you are looking for a vectorized method. I am not at all s...

etwa 10 Jahre vor | 0

Beantwortet
How to generate vector of n random numbers between 0 and 1 to x decimal places?
You might be interested in the function I wrote for the File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/9...

etwa 10 Jahre vor | 0

Beantwortet
Subscript indices error when plotting
This is your problem: X(i,2) = Cv; Y(i,2) = SWR; Matlab is objecting to the fact that 'i' is being used as an index...

etwa 10 Jahre vor | 1

| akzeptiert

Beantwortet
Euclidean Distance (Back to the Math...complete with two loops)
Apparently what you want is this: for l = 1:3 for m = 1:3 C(l,m) = sum((A(l,:)-B(m,:)).^2); end end This ...

etwa 10 Jahre vor | 2

| akzeptiert

Beantwortet
Inaccuracy in obtaining the Absorption coefficient
In your expression for 'fa' you need to use dots in the division operations on vectors: fa = (((0.11*(xa))./(1+(xa))) + ((4...

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
Find the best combination of each pair of entries in a matrix
The number of possible bijections for an n-by-n matrix, M, would be n factorial. Use 'perms' to generate all possible permutati...

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
What is the difference between these two scripts; and which one is more appropriate to use
In "u = squeeze(tdata(1,:,:)./10);" the first level of the first dimension of three-dimensional 'tdata' is divided by 10 and con...

etwa 10 Jahre vor | 0

Beantwortet
removing zeros from matrix
A = A.'; A = reshape(A(A~=0),3,4).';

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
Streamlining Code for Efficiency
TotalNew = bsxfun(@times,(y(:,1)+y(:,2)<=1)&(y(:,2)==y(:,6))&(1-y(:,3)+y(:,1)+y(:,2)>=1),y);

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
age matching between two groups
There is a very crude brute force method, but it is only practical for a limited range of sizes of the two groups. I suppose fi...

etwa 10 Jahre vor | 1

| akzeptiert

Beantwortet
How can I compare two traces in a more efficient way?
See if 'pdist2' would be any faster: A(:,5) = min(pdist2(A(:,1:2),B(:,1:2),'squaredeuclidean'),[],2);

etwa 10 Jahre vor | 0

Beantwortet
overlapping area between two circles
Let the distance between the centers of two circles be d and their two radii be r1 and r2. Then the area, A, of the overlap reg...

etwa 10 Jahre vor | 1

Beantwortet
How to convert this c code in to matlab.
In the first place, the arrays X13, X14, and X16 will have to be changed to start at index 1, not 0. Matlab does not allow an i...

etwa 10 Jahre vor | 1

Beantwortet
Using integral3 to calculate the conditional expectation of an RV
Since you are computing the conditional expected value, you need to divide your integral by the probability of satisfying X>Y & ...

etwa 10 Jahre vor | 2

Beantwortet
How to calculate round off error in each step of finite central difference approximation.
The lines e1(i) = f(x-h)-round(f(x-h)); e2(i) = f(x+h)-round(f(x+h)); Roundoff(i) = abs((e2(i)-e1(i))/(2*h)); do ...

etwa 10 Jahre vor | 0

Beantwortet
Error using bitxor Matrix dimensions must agree. key1=bitxor(a,b);and key=imresize(key1,[1 256])
As you have written the code, the numbers of elements in 'a' and in 'b' depend on how many bits are required to represent 'sud1'...

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
how to obtain all combinations of n numbers for following condition
The problem posed in the 'Answer' request below is equivalent to your question with three baskets. The different numbers can be...

etwa 10 Jahre vor | 1

Beantwortet
How to integrate x*f(x) in Matlab? f(x) is normal distribution density function.
With f(x) of the form K*exp(-(x-m)^2/(2*s^2)), you can write x*f(x) = m*f(x) + (x-m)*f(x) The integral of the first of th...

etwa 10 Jahre vor | 0

Beantwortet
surface area of a 3D surface
If you know the 3D coordinates of each of the three vertices for each triangle in your diagram, then just take the sum of all th...

etwa 10 Jahre vor | 3

| akzeptiert

Beantwortet
I'm trying to find what do I need to add to the negative values to get the correct DeltaT? I also need to find where they are negative.
It's as the error message states. You went one too far in 'Min'. Apparently there are 337678 elements in 'Data.min' and in 'Da...

etwa 10 Jahre vor | 0

Beantwortet
I have one matrix 5X5 at MatLab, and, for each line, I need to select one random value of one column of that matrix. How can I do that without repeat columns?
I assume by 'line' you mean 'row', and that you want a random column selected in each row without a duplication of columns. Le...

etwa 10 Jahre vor | 0

Beantwortet
How to sort vectors so every 1 entry is collected and followed by every 2 entry until the nth entry
s = reshape([a;b;c;...;m],1,[]);

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
Precision issues when checking for a whole number
Actually x>=0 and either round(x)==x, floor(x)==x, or ceil(x)==x are always valid tests for whether x is a whole number *as stor...

etwa 10 Jahre vor | 0

Mehr laden