Beantwortet
Create vector with unique values
% I'm sure there is no repetition but the set of values is not random r = 1+randperm(5000)/5000; % check all(r>=1 & r<=2) ...

mehr als 4 Jahre vor | 1

Beantwortet
Interp1 Function gives back NaN in second to last datapoint
MATLAB interp1 by default gives NaN for query points falling outside your source points (first and last). Use 'extrap' option (...

mehr als 4 Jahre vor | 0

| akzeptiert

Gesendet


qsort
Sort data with user-supplied comparison function

mehr als 4 Jahre vor | 1 Download |

0.0 / 5

Beantwortet
multiplying matrix by a vector on an element by element basis using for loops
To be able to compute A*B; You need B is column (vector): the number of rows of B much match the number of rows of A, 5 in this ...

mehr als 4 Jahre vor | 0

Beantwortet
How to sort eigenvalues when performing generalized nyquist criterion on 2x2 matrix?
Replace statement E1(:,k) = eig(Z_nyquist1); by % track eigen values ----------------------------------------------- ...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
null() fails for a symbolic numeric 5x5 matrix
Just a wild guess but when you call null(A) with symbolic matrix, MATLAB tries to solve for lambda the equation det(A - lambda*...

mehr als 4 Jahre vor | 0

Beantwortet
Is cell2mat supposed to support non-plaid cell partitioning? If not, why not?
But this one works Ctlarge={rand(1,2) rand(1,1) rand(1,0); rand(3,1) rand(3,2) rand(3,0)} cell2mat(Ctlarge) You can edit the ...

mehr als 4 Jahre vor | 1

| akzeptiert

Beantwortet
How to concatenate first column of matrix A and first column of matrix B, then second column of matrix A and second column of matrix B and so on?
A = randi(10,2,3) B = randi(10,2,3) reshape([A;B], size(A,1), [])

mehr als 4 Jahre vor | 0

Frage


why wrapping with anonymous function speeds up?
I try to understand the rational behind this result. When I wrap a function within an anonymmous function, it runs almost 10 tim...

mehr als 4 Jahre vor | 1 Antwort | 1

1

Antwort

Frage


Profiler: time spend at while END statement
I run a profiler on my code, and it is reported a significant amount of time is at the "end" statement of a while loop (here i, ...

mehr als 4 Jahre vor | 1 Antwort | 0

1

Antwort

Beantwortet
split the matrix into two
A = randi(10,3,6) B = A(:,1:2:end) C = A(:,2:2:end)

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to find 5 consecutive values above threshold within a certain window?
A = [6 7 8 8 8 7 6 7 6 2 7 8 9 3 3 4 6 7 8 9] win = 5; threshold=5; maxreject=3; % Pad NaNs so that the length is multiple...

mehr als 4 Jahre vor | 0

Beantwortet
How to have Matlab create a random matrix that is fullrow rank?
Here is a way to generate finite condition number matrxix , meaning stronger than full rank, and it must give a full rank (unles...

mehr als 4 Jahre vor | 1

Beantwortet
Generalized sorting function with user defined (template-)criterion
AFAIK there is no such thing in stock function in MATLAB, the main reason is MATLAB function calling mechanism will kill the per...

mehr als 4 Jahre vor | 1

Beantwortet
How to reshape an M x (aN) matrix into a (aM) x (N) matrix in MATLAB?
Use permute m = 3; n = 2; a = 4; A = reshape(zeros(m,n)+reshape(1:a,[1 1 a]),[m n*a]); A B = reshape(permute(reshape(A,[...

mehr als 4 Jahre vor | 1

| akzeptiert

Beantwortet
Determining relative angular orientation of vectors
No need to call costly trigonometric functions % Direction of incidence Ray (normalized) Rayi = randn(2,1); Rayi = Rayi/norm(...

mehr als 4 Jahre vor | 0

Beantwortet
I need to find the length of the longest strictly increasing subsequence array from a given array I just need a tip to start. Any type of help will be appreciated
Dynamic programming, it may take longtime for large array a = [0,1,2,3,4,1,2,0,4,5,8,9,11,11,4,4,9,9]; i = longestsubseq_helpe...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to solve the following type of equation that includes summation in matlab?
Assuming H_m and t_m are stored in (1 x M )arrays % Dummy test data M = 10; H = rand(1,M); t = rand(1,M); P = sum( abs(H...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
I need to find the length of the longest strictly increasing subsequence array from a given array I just need a tip to start. Any type of help will be appreciated
a=rand(1,1000000); idx=find(diff([false diff(a)>0 false])); [lgtmax, j]=max(idx(2:2:end)-idx(1:2:end)); longestincreasedsub...

mehr als 4 Jahre vor | 0

Beantwortet
Sort vector A according to vector B
A = [0.9; 0.2; 0.4; 0.2; 0.3; 0.4; 0.7; 0.4; 0.1; 0.8; 0; 0; 0; 0]; B = [0; 0; 1; 1; 1; 1; 0; 0; 0; 0; 0; 0; 0; 0]; Ais0=A==...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to find the index of first and last nonzero elements in each column?
Some C-mex solution for speed: https://fr.mathworks.com/matlabcentral/fileexchange/24641-vectorized-find-with-first-option?s_ti...

mehr als 4 Jahre vor | 0

Beantwortet
How to find the index of first and last nonzero elements in each column?
Let you do conversion to linear index A=[0 0 0 0 0 0 0 0 1 0 4 8 2 0 ...

mehr als 4 Jahre vor | 0

Beantwortet
Symbolic multidimensional arrays with changable dimension
p = [1 2 3 4]; c = [1 2 3 4; 1 2 3 4; 1 2 3 4; 1 2 3 4]; n=3; M = p(:); % EDIT, bug fix for k=1:n-1 cc = reshape(c, [...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
What function in MATLAB for calculating the value of inverse standard normal distribution function?
There is no sense to substract 1 to *inverse* CPF, which take argument value in (0,1) and maps to (-Inf,Inf). It only makes sens...

mehr als 4 Jahre vor | 0

Beantwortet
Making a spherical cap using equations of sphere
phi=linspace(pi/2,pi/6,30); % the cap end is determined by pi/6 change accordinglt theta=linspace(0,2*pi,120); r=3; [PHI,TH...

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
Converting location of a 2x3 vector into a matrix with value 1
a = [1,3;2,4;7,8]; % assumed there is no repeated indexes A = accumarray(a,1,[10,10])

mehr als 4 Jahre vor | 1

Beantwortet
Gaussian fiiting of a truncated data
Remove the data above 1.96 and fit with the rest.

mehr als 4 Jahre vor | 0

| akzeptiert

Beantwortet
How do I generate a random number between two numbers with using a distribution
% define the siscrete value and their relative pdf xval=(-10:10); p=exp(-(xval/5).^2); % Gaussian function, triangular whateve...

mehr als 4 Jahre vor | 1

| akzeptiert

Beantwortet
How do I create this full diagonal matrix
n = 5; A = n-abs((1:n)'-(1:n))

mehr als 4 Jahre vor | 0

Beantwortet
How to partially validate arguments?
I believe the issue is that your argument isn't self consistent. When you use syntax such as optional_positional = 1 That mea...

mehr als 4 Jahre vor | 1

| akzeptiert

Mehr laden