Risposto
warning in Polyval - Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.
Check your data with this command all(isfinite(rawData(:))) if it returns 0/false then your data is not valid

circa 2 mesi fa | 0

Risposto
Does linprog support warm-starts?
Not that I'm aware of.

circa 2 mesi fa | 0

| accettato

Risposto
How to detect whether a figure is created by uifigure()
This command sreturns true for uifigure handle fig matlab.ui.internal.isUIFigure(fig)

circa 2 mesi fa | 0

| accettato

Risposto
Trying to optimise this loop
function WriteOutValuesToAFile(filename,M) fileID = fopen(filename,'wt'); for k=1:size(M,3); s = sprintf('%f,', M(:,:,k))...

2 mesi fa | 0

Risposto
How to do a layered matrix--vector multiplication without a for loop?
NNN = 10; RR = rand(NNN, 3); TT = rand(3,3,NNN); for iii = 1:1:NNN TRR(iii,:) = TT(:,:,iii) * RR(iii, :).'; % Bug fix ...

2 mesi fa | 2

| accettato

Risposto
Convert Quaternion to Euler angle extrinsically
Here is the answer by MATLAB code: extrinsic angles is flip intrinsic angles % Generate random unit quaternion q = quaternion(...

2 mesi fa | 1

Risposto
Why I receive an error when my code is in function but not when he's in editor ?
You could consider to vectorize the test instead of using for loop and the side effect when deleting array element(s). I don't k...

2 mesi fa | 0

Risposto
Why I receive an error when my code is in function but not when he's in editor ?
Loop in reverse would fix the issue (cross interaction between deletion that makes array strinks and loop index) for i = si...

2 mesi fa | 0

| accettato

Risposto
Seeking Help: Deleting Redundancy in a Structure Array
a(1).pos=[1,7,1]; a(2).pos=[1,7,1]; a(3).pos=[6,5,5]; a(4).pos=[1,4,3]; a(5).pos=[2,2,2]; P = cat(1, a.pos); [~, I] = un...

2 mesi fa | 0

| accettato

Risposto
How to generate a random 3D vector with set magnitude?
MagTarget = 10; MagRange = 0.5; n = 1000; m = MagTarget + MagRange * (rand(1,n)-0.5); xyz = randn(3,n); xyz = xyz .* (m ./ ...

2 mesi fa | 2

Risposto
Interpolation schemes that produce positive second derivatives of the interpolant
You can use approximation spline, just put more (denser) knots than the data points so it actually interpolates. For example us...

2 mesi fa | 0

| accettato

Risposto
scatteredInterpolant function gives error in input data if I try to interpolate a vectorial field where for each point I have 2 values, but in the doc it says that is allowed.
I guess you use an old MATLAB version that doesn't support vector interpolation. EDIT the doc is for 2023b more recent than you...

2 mesi fa | 2

| accettato

Domanda


sum results depending on array orientation
The issue of sum depending to array orientation is reported by @Matt J in this thread To me the flaw is serious enough that it ...

2 mesi fa | 2 risposte | 0

2

risposte

Risposto
Just by changing values of k, the given code gives error. Why?
k need to be column vector and your transposed is miss placed. The correct is k = -((M/2-1):M/2).';

3 mesi fa | 0

| accettato

Risposto
Quickest way for alternate indexing a vector
Try to do something clever (1st and 2nd methods) but it is slower than your code 53rd method). A small modificationof your code ...

3 mesi fa | 1

Risposto
function to generate collections of integers that all sum to the same value?
Look in File Exchange with the keywords integer partition. You'ill find many implementations for example this one: https://www....

3 mesi fa | 0

| accettato

Risposto
Matlab memory optimization regarding output arguments
You better have your funtion codded like this function functie() x = 9; % Remove the braket x = functieLocala(x); ...

4 mesi fa | 1

Risposto
Size mismatch (size [1 x :?] ~= size [0 x 1]) - GPU Coder Deployment
Try to initialize index = zeros(1, 0); since you concatenate index horizontally in the for loop.

4 mesi fa | 0

Risposto
How can we compute batch matrix-matrix product of matrices (3-D tensors) in MATLAB?
b = 2; n = 3; m = 4; p = 5; A = rand(b,n,m); B = rand(b, m,p); AA = permute(A, [2 3 1]); BB = permute(B, [2 4 1 3]); ...

4 mesi fa | 0

| accettato

Risposto
An annoying extrapolation problem
Because you insist on using anonymous function and ugly combined expression using scalar logical expression. The trick is no lon...

4 mesi fa | 0

| accettato

Risposto
Why is the result matrix “rho” of function corr (A, B) not a symmetric matrix?
As the doc describe, for example rho(2,1) is the correlation between X(:,2) and Y(:,1) rho(1,2) is the correlation between X(:...

4 mesi fa | 0

| accettato

Risposto
How to efficiently index into memory and call functions within for loops
When you index a hybrid slide (j positive integer scalar) % x = ... % j = ... xidx = x(:,:,:,j,:,:) (here I take a 6D array ...

4 mesi fa | 0

| accettato

Risposto
is there a way to perform this task w/o using loops?
You might consider store in table instead NOTE: using table would be more convenient to access data, not necessary faster p.va...

4 mesi fa | 1

Risposto
How can I stabilize the matrix left division (i.e. "\")?
Try pinv, lsqminnorm it can stabilize somewhat the inversion with (near) singular matrix. Both bave a tolerance argument to tune...

4 mesi fa | 0

Risposto
square matrix containing Chebyshev polynomials becomes singular when its size becomes greater than a certain value
That is exactky what I have suggested in my answer: use the Chebyschev nodes t0 = 0; tf = 4; N = 75; syms x h = chebyshevT(...

4 mesi fa | 0

Risposto
square matrix containing Chebyshev polynomials becomes singular when its size becomes greater than a certain value
If you select discrete points d the Chebychev nodes see definition wiki, and not uniform, it will become well posed.

4 mesi fa | 0

Risposto
interpolate a 2D map (array) of density samples and preserve the total ?
Use trapz for the integration (not sum), it should match (up to round off) with linear interpolation and interger subsamping fo...

4 mesi fa | 0

Domanda


xlabel/ylabel 'HorizontalAlignment' issue
I don't understand the 'HorizontalAlignment' of the text labels. It is not centered (when the figure has different size than the...

4 mesi fa | 1 risposta | 2

1

risposta

Risposto
Coefficents of piecewise polynomial in matlab
Similar answer as here points = [1 0 -1 0 1;0 1 0 -1 0]; pp = cscvn(points) m = pp.dim; p = pp.pieces; %D = diff(poi...

4 mesi fa | 0

Risposto
cscvn of a function, coefficients and breaks
This is how to use pp m = 2; n = 5; % 25 in the original question points = rand(m,n); pp = cscvn(points) m = pp.dim; p =...

4 mesi fa | 0

Carica altro