Réponse apportée
extract field from a structure problem
depending on the content, if scalar tmp=[DP1.P] or if not tmp={DP1.P}

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
How to solve this matrix?
>> P=[0.2 0.4 0.4; 1 0 0; 0.5 0.25 0.25] P = 0.2000 0.4000 0.4000 1.0000 0 0 0.5000 ...

plus de 7 ans il y a | 0

Réponse apportée
Intersection of three and more arrays
My FEX returns the index of the arrays

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
How to randomly choose 3 values ​​from the first column.
A(randperm(size(A,1),3),1)

plus de 7 ans il y a | 2

| A accepté

Réponse apportée
How can I find a fit to my data points and using triangulation to approximate the planar area?
Quick and dirty fix, just discard outside delaunay triangles with long sides load('x-data.mat'); load('y-data.mat'); xy = [...

plus de 7 ans il y a | 0

Réponse apportée
Overcome for loops for fast processing
skin_rgb = 0; for i = [2000 : 2003,2008,2010:2011,2013:2015,2017:2018,2021,2024,2027:2041,2043,2045:2059,2061:2063] I = im...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
calculation of a mean
splitapply(@mean,data,ceil((1:size(data,1))'/10))

plus de 7 ans il y a | 1

Réponse apportée
Combinations of a vector with replacement
A = [2 3 4] [A1,A2] = ndgrid(A); arrayfun(@(k) polyval([A2(k),A1(k)],10), 1:numel(A1)) [A1,A2,A3] = ndgrid(A); arrayfun(...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
Rotate 3D axis camera perspective about arbitrary direction vector
Here is a demo to show using Camera parameters, I also put the rotation matrix R in comment. I find MATLAB parameters more intui...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
How to efficiently multiply each element of a matrix with every other element of two other matrices, i.e. in least time possible?
[m,n] = size(A); AA = reshape(A,1,1,m,1,1,n); BB = reshape(B,1,m,1,1,n,1); CC = reshape(C,m,1,1,n,1,1); V = AA.*BB.*CC; V =...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
Replace values in one column based on the content in several other columns.
A = [1 1 1 0; 1 2 1 1; 2 1 1 3; 1 1 1 3; 2 1 2 4] B = [1 1 1 1; 1 2 1 0] [b,loc] = ismember...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
CAN I FIND FLOPS FOR A CODE WHICH I HAVE WRITTEN
If you can find an old R6.0 of MATLAB, and your code is able to run with it there is a command floops(). Since MATLAB use LAPAC...

plus de 7 ans il y a | 0

Réponse apportée
Creating a vector which goes across all x y and z values
The dot product between [0 2 0] and [x,y,z] is 2*y So just do dotresult = 2*y

plus de 7 ans il y a | 0

Réponse apportée
Creating a georeferenced polygon
You can get a linear connected contour (polygon) by C = contourc(lat,lon,double(isfinite(dro_dom_fill)),0.5*[1 1]); C = C(:,...

plus de 7 ans il y a | 0

Réponse apportée
how to find the first element that satisfy a condition in a matrix?
Try this for j = 1:ny idx_start(:,j) = find(Dwf(:,j)> 0.01,1,'first') ; idx_end(:,j) = find (Dwf(:,j) < 0 & (1:nx)...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
Compiling with Matlab instead of interpreting
MATLAB calls FFTW library behind the scene, so if you are doing heavily FFT for convolution, there is not much speed penalty. I...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
Rotate 3D axis camera perspective about arbitrary direction vector
HGTRANSFORM ?

plus de 7 ans il y a | 0

Réponse apportée
How to order vertices of a flat convex polygon in 3d space along the edge?
<</matlabcentral/answers/uploaded_files/140726/PolySorted.png>> xyz =[... -2.6055 1.1850 0.0880; -2.6320 1.170...

plus de 7 ans il y a | 3

| A accepté

Réponse apportée
Overdetermined system of equations - 8 degree polynomial
If you rescale your data, making for example x coordinates between (-1,1) it might hep to get a better condition linear system. ...

plus de 7 ans il y a | 1

Réponse apportée
How to find the largest factor of a number using while loops?
largestfactor=floor(n/2); while largestfactor>0 if mod(n,largestfactor)==0 break end larges...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
If i have array defined as G=(83 27 125 99 0 25 255 ..... ) .Is there any command or code to find S as defined below ?
correct ranging if the minimum of G starts from 0: clear S S(G+1) = 1:numel(G)

plus de 7 ans il y a | 0

Réponse apportée
Quaternions, Transformation Matrix
Such thing is straight forward in MATLAB q1 = reshape(q1,1,1,[]); q2 = reshape(q2,1,1,[]); q3 = reshape(q3,1,1,[]); ...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
What is background technique of fsolve ?
The relevant information is in Algorithm part in the bottom of the <https://fr.mathworks.com/help/optim/ug/fsolve.html Doc>, jus...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
How can I plot 3D surface x^3 + y^3 + z^3 = 1, where x, y, z are in unit closed interval in MATLAB ?.
<</matlabcentral/answers/uploaded_files/140679/xyzcube.png>> <</matlabcentral/answers/uploaded_files/140680/xyzcube.png>> ...

plus de 7 ans il y a | 1

Réponse apportée
Combining K matrices in one matrix
X = reshape(cat(3,a,b,c),[],3)

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
How to construct the n*n matrices, like below:
Such matrix is a FEM/discrete laplacian, and I strongly recommend using sparse matrix whene ever solving PDE. n = ... S ...

plus de 7 ans il y a | 0

Réponse apportée
How to solve 3 equations dependent each other?
_Actually i thought it is going to be easy but when i write the code for wx, i realized that wx is increasing with time but wz a...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
Index exceeds the number of array elements (1) error
%assign initial gues to unknowns th3(k)=x(1);th5=x(2); th6=x(3);to=x(4); I think it should be ...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
Interp1 returning NaN for ode45
V = interp1(V,t_interp,t,'pchip'); It looks arguments are swapped; I think it should be V = interp1(t_interp,V,t,'pchi...

plus de 7 ans il y a | 1

| A accepté

Charger plus