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

más de 7 años hace | 1

| aceptada

Respondida
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 ...

más de 7 años hace | 0

Respondida
Intersection of three and more arrays
My FEX returns the index of the arrays

más de 7 años hace | 0

| aceptada

Respondida
How to randomly choose 3 values ​​from the first column.
A(randperm(size(A,1),3),1)

más de 7 años hace | 2

| aceptada

Respondida
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 = [...

más de 7 años hace | 0

Respondida
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...

más de 7 años hace | 1

| aceptada

Respondida
calculation of a mean
splitapply(@mean,data,ceil((1:size(data,1))'/10))

más de 7 años hace | 1

Respondida
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(...

más de 7 años hace | 1

| aceptada

Respondida
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...

más de 7 años hace | 0

| aceptada

Respondida
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 =...

más de 7 años hace | 0

| aceptada

Respondida
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...

más de 7 años hace | 0

| aceptada

Respondida
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...

más de 7 años hace | 0

Respondida
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

más de 7 años hace | 0

Respondida
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(:,...

más de 7 años hace | 0

Respondida
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)...

más de 7 años hace | 0

| aceptada

Respondida
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...

más de 7 años hace | 1

| aceptada

Respondida
Rotate 3D axis camera perspective about arbitrary direction vector
HGTRANSFORM ?

más de 7 años hace | 0

Respondida
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...

más de 7 años hace | 3

| aceptada

Respondida
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. ...

más de 7 años hace | 1

Respondida
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...

más de 7 años hace | 1

| aceptada

Respondida
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)

más de 7 años hace | 0

Respondida
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,[]); ...

más de 7 años hace | 0

| aceptada

Respondida
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...

más de 7 años hace | 0

| aceptada

Respondida
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>> ...

más de 7 años hace | 1

Respondida
Combining K matrices in one matrix
X = reshape(cat(3,a,b,c),[],3)

más de 7 años hace | 1

| aceptada

Respondida
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 ...

más de 7 años hace | 0

Respondida
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...

más de 7 años hace | 0

| aceptada

Respondida
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 ...

más de 7 años hace | 0

| aceptada

Respondida
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...

más de 7 años hace | 1

| aceptada

Cargar más