Respondida
How do I find the coordinates inside a rectangle or triangle?
INTERP2

más de 7 años hace | 0

Respondida
select numbers based on different probabiltiies
select = rand < 1e-6

más de 7 años hace | 1

| aceptada

Respondida
How i Calculate the average number of even numbers in an array?
a = [1.3700 1.2200 2.2000 2.2800]; ac = round(a*100); mean(ac(mod(ac,2)==0))/100 result ans = 1.9000

más de 7 años hace | 0

| aceptada

Respondida
what is non-local total variation regularizarition (NLTV)?
That means the regularization of the image I(x,y) is of the form integral of lambda(x,y) | grad I (x,y) | dx*dy. lambda(x,y) i...

más de 7 años hace | 0

Respondida
Using the cubic spline code below, I need to extract the value found for x = 3.5. How do I call this value?
Run this after your code >> tempx = 3.5 tempx = 3.5000 >> [~,i] = histc(tempx,x); >> a(i) + b(i)*(tempx-x(i))+c(...

más de 7 años hace | 0

| aceptada

Respondida
Which mldivide ('\') function is better
Use pseudo inverse PINV to get more stable solution. Never use "\" on nearly singular matrix. You are happy with 2008 is just pu...

más de 7 años hace | 0

| aceptada

Respondida
Is "ismultithreaded" function exist?
Not that I'm aware of, in any case they will give out such information since they (TMW) have a habit to consider speed optimizat...

más de 7 años hace | 0

Respondida
FFT seems to be not calculating Nyquist component?
Change A*sin(2*pi*Fs/2*t) to A*cos(2*pi*Fs/2*t) Or alternativey you must put cos expression in the imaginary part of your...

más de 7 años hace | 1

| aceptada

Respondida
Structure array slower than loose variables
Yes acessing field names is slow., so try to avoid doing it intensively.

más de 7 años hace | 1

| aceptada

Respondida
How to solve a complex-valued equation
So your equation is of the form a / (g - x)^2 = k* x Just multiply by (g - x)^2 in both sides, you'll get a = (g - x)^2 * k* ...

más de 7 años hace | 1

| aceptada

Respondida
For Loop to concatenate Matrix Product
A_All = []; A_0toAll = []; C_i = 1; for i=1:5 T_i = [i+2 i+3 i+4 i+5; i+3 i+4 i+5 i+6; i+4 i+...

más de 7 años hace | 0

| aceptada

Respondida
Force slope and return intercept value (assuming a non-zero intercept)
m = WhatYouWantItToBe k = mean(log10(y)-m*log10(x))

más de 7 años hace | 1

| aceptada

Respondida
get vector from a matrix ith row or column based on given dimension
c = repmat({':'},1,ndims(A)); c{dim}=i; A(c{:})

más de 7 años hace | 2

| aceptada

Respondida
Finding PDF for difference of two PDFs
For 2 dependent variables A and B, the pdf of A+B is pdf(A+B) = pdf(A) * pdf(B) where "*" is a continuous convolution operator...

más de 7 años hace | 0

Respondida
Specified number of ones in the matrix (column and row)
From an idea by Akira Agata n = 10; % Matrix dimension k = 4; % row/column sum target of 1s r = [ones(1,k) zeros(1,n-k)]; ...

más de 7 años hace | 2

Respondida
Using a vector as an index to a matrix
[m,n,p] = size(A); [I,J] = ndgrid(1:m,1:n); C = A(sub2ind([m,n,p],I,J,b(I)))

más de 7 años hace | 0

| aceptada

Respondida
Low Level Graphics Error
After crash you migh run opengl hardware opengl('save','hardware') to restore value. I systematically have opengl crash whe...

más de 7 años hace | 0

| aceptada

Respondida
Finding rows of matrix A that do not overlap with any rows in Matrix B (without using for or while loop)
Assuming A and B are column-sorted for all rows A= [ 0 50; 200 250; 300 350; 400 450]; B=[50 200; 200 300; 300 400]; BB=res...

más de 7 años hace | 0

| aceptada

Respondida
Need help with solving system of ODEs in Matlab
y=zeros(m, N+1); % numerical approx. vector I think it should be y=zeros(N+1,m); % numerical approx. vector Those things ...

más de 7 años hace | 0

| aceptada

Respondida
preallocate array without initializing
MEX can do that, use for example this utility

más de 7 años hace | 1

Respondida
How to change matrix numbers positions
X(randperm(numel(X))) = X

más de 7 años hace | 0

Respondida
Difference between the individual rows of B and all the rows of A.
DIF = zeros(size(A,1),size(B,1)) for k=1:size(B,1) DIF(:,k)=sqrt((A(:,1)-B(k,1)).^2+(A(:,2)-B(k,2)).^2+(A(:,3)-B(k,3)).^2)...

más de 7 años hace | 1

| aceptada

Respondida
Project 3D points onto a 2D plane with least overlap
Assuming your data points is store in (n x 3) array xyz xyzc = mean(xyz,1); [~,~,V] = svd(xyz - xyzc,0); xy2d = xyz*V(:,1:2);...

más de 7 años hace | 1

Respondida
Finding PDF for difference of two PDFs
Not sure if it helps but the green area is { (x:y) : 0 <= y <= min(p1(x),p2(x)) }

más de 7 años hace | 0

Respondida
randsample([0 1],1,true,[1 - p p]) ..... with p as a vector?
Assuming yoy have p in a vector r = rand(size(p))<p

más de 7 años hace | 0

Respondida
How can I efficiently (with no loops) compute the mean of each column in a matrix, taking different elements from each column?
M = [ 1 2 3 4 5; ... 6 7 8 9 10; ... 11 12 13 14 15]; idx = [ 1 2 3 2 1; ... 2 3 3 3 3]; m = si...

más de 7 años hace | 1

| aceptada

Respondida
How can I efficiently (with no loops) compute the mean of each column in a matrix, taking different elements from each column?
M = [ 1 2 3 4 5; ... 6 7 8 9 10; ... 11 12 13 14 15]; idx = [ 1 2 3 2 1; ... 2 3 3 3 3]; [m...

más de 7 años hace | 0

Respondida
Generate all possible combinations
A = [1;2] B = [3;4] C = [5;6] D = [7;8] L = {A,B,C,D}; n = length(L); [L{:}] = ndgrid(L{end:-1:1}); L = cat(n+1,L{:}); ...

más de 7 años hace | 2

| aceptada

Respondida
Generate All Possible combinations
A = [2;4;6] B = [1;3;5] [AA,BB] = meshgrid(A,B); C = [AA(:),BB(:)] ans = 2 1 2 3 2 5 ...

más de 7 años hace | 0

| aceptada

Respondida
How can I compute all the possible differences of the vectors in a matrix?
>> A = [1,2,3; 4,0,1; 2,3,5; 6,0,1]; >> r2 = nchoosek(1:size(A,1),2) r2 = 1 2 1...

más de 7 años hace | 0

Cargar más