Answered

How to pass a vector to a function that creates matrix

>> b=[1 2 3]*10; >> T=@(i) [b(i)+9 , 8 ; 8 , 7 ]; >> T(3) ans = 39 8 8 7

How to pass a vector to a function that creates matrix

>> b=[1 2 3]*10; >> T=@(i) [b(i)+9 , 8 ; 8 , 7 ]; >> T(3) ans = 39 8 8 7

9 Tage ago | 0

Answered

how to calculate direction in rotated coordinate system

Using AxelRot (Download), and assuming all angles are given in radians, [x,y,z] = sph2cart(Azi_Old,Elev_Old,1); P=AxelRot( ...

how to calculate direction in rotated coordinate system

Using AxelRot (Download), and assuming all angles are given in radians, [x,y,z] = sph2cart(Azi_Old,Elev_Old,1); P=AxelRot( ...

10 Tage ago | 0

Answered

How to work with Nelder-Mead algorithm with 7 unknown variables?

You can use fminsearch (an implementation of Nelder-Mead) with any number of variables. However, there is no way to gaurantee th...

How to work with Nelder-Mead algorithm with 7 unknown variables?

You can use fminsearch (an implementation of Nelder-Mead) with any number of variables. However, there is no way to gaurantee th...

10 Tage ago | 2

Answered

f(x)=sin(x)-x^5=0 providing x is not equals 0 ,function in the interval x [0,3]

>> [x0,fval]=fzero(@(x)sin(x)-x.^5,[0.8,1]) x0 = 0.9610 fval = -1.1102e-16

f(x)=sin(x)-x^5=0 providing x is not equals 0 ,function in the interval x [0,3]

>> [x0,fval]=fzero(@(x)sin(x)-x.^5,[0.8,1]) x0 = 0.9610 fval = -1.1102e-16

10 Tage ago | 0

| accepted

Answered

Generating Toeplitz Matrix which Matches the Convolution Shape Same

Using interpMatrix (Download), nH=numel(vH); nX=numel(vX); ic=ceil( (nH+1)/2); mH = interpMatrix(vH,ic , nX,1);

Generating Toeplitz Matrix which Matches the Convolution Shape Same

Using interpMatrix (Download), nH=numel(vH); nX=numel(vX); ic=ceil( (nH+1)/2); mH = interpMatrix(vH,ic , nX,1);

10 Tage ago | 0

Answered

Generating Toeplitz Matrix which Matches the Convolution Shape Same

I am specifically asking about using the function toeplitz(). If it must be with toeplitz, then: nH=numel(vH); nX=numel(vX); ...

Generating Toeplitz Matrix which Matches the Convolution Shape Same

I am specifically asking about using the function toeplitz(). If it must be with toeplitz, then: nH=numel(vH); nX=numel(vX); ...

10 Tage ago | 0

| accepted

Answered

Concatenating matrices in a file into another matrix

For example, >> p1=[1,2,3]; p2=[4 5 6]; p3=[7 8 9]; save p p1 p2 p3 >> A=cell2mat(struct2cell(load('p'))) A = 1 ...

Concatenating matrices in a file into another matrix

For example, >> p1=[1,2,3]; p2=[4 5 6]; p3=[7 8 9]; save p p1 p2 p3 >> A=cell2mat(struct2cell(load('p'))) A = 1 ...

10 Tage ago | 0

| accepted

Answered

Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.240406e-24.

Even with A\B, you cannot expect reliable behavior with RCOND as small as 2.240406e-24. For all intents and purposes, your mat...

Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.240406e-24.

Even with A\B, you cannot expect reliable behavior with RCOND as small as 2.240406e-24. For all intents and purposes, your mat...

10 Tage ago | 0

Answered

Fit a conic section without mirror image hyperbola

This approach uses John's fminspleas FEX submission (Download). Although the fit is, technically, a hyperbola, it diverges to a ...

Fit a conic section without mirror image hyperbola

This approach uses John's fminspleas FEX submission (Download). Although the fit is, technically, a hyperbola, it diverges to a ...

10 Tage ago | 1

Answered

rotating and saving images to folder: error during loop

The code works fine for me. If I had to guess, I would say it is because you ran the code previously while debugging and never c...

rotating and saving images to folder: error during loop

The code works fine for me. If I had to guess, I would say it is because you ran the code previously while debugging and never c...

10 Tage ago | 0

Answered

Defining constraints in the Quadratic Programming

If you have a quadratic function of only 1 unknown variable, it should be possible to find the minimum analytically - no iterati...

Defining constraints in the Quadratic Programming

If you have a quadratic function of only 1 unknown variable, it should be possible to find the minimum analytically - no iterati...

10 Tage ago | 0

Answered

PARFOR: Broadcast variable

The code looks suspiciously like an attempt at weighted normalized cross-correlation. If so, see here for a possibly faster alte...

PARFOR: Broadcast variable

The code looks suspiciously like an attempt at weighted normalized cross-correlation. If so, see here for a possibly faster alte...

11 Tage ago | 1

Answered

Forming a block diagonal matrix of one certain matrix?

using interpMatrix (Download) S=1*ones(2); B=2*ones(2); C=3*ones(2); copies=4; %number of repetitions L=flip( {S,B,C, z...

Forming a block diagonal matrix of one certain matrix?

using interpMatrix (Download) S=1*ones(2); B=2*ones(2); C=3*ones(2); copies=4; %number of repetitions L=flip( {S,B,C, z...

11 Tage ago | 0

Answered

Generating Toeplitz Matrix which Matches the Convolution Shape Same

Using func2mat (Download), mH=func2mat(@(vX) conv(vX, vH, 'same'), ones(length(vX),1));

Generating Toeplitz Matrix which Matches the Convolution Shape Same

Using func2mat (Download), mH=func2mat(@(vX) conv(vX, vH, 'same'), ones(length(vX),1));

11 Tage ago | 0

Answered

Fast method to find average pairwise distance of a very large matrix?

I don't know about the mean distance, but the mean squared or root mean squared distance is pretty easy. Compare: A=rand(330000...

Fast method to find average pairwise distance of a very large matrix?

I don't know about the mean distance, but the mean squared or root mean squared distance is pretty easy. Compare: A=rand(330000...

14 Tage ago | 0

Answered

Creating a Random Upper Triangular Matrix with Unique Entries for Efficiently Computing Matrix Exponential.

Just use randi, e.g., >> k=8; M = triu(randi(10,k,k)) M = 9 10 5 7 3 5 8 10 0 10 ...

Creating a Random Upper Triangular Matrix with Unique Entries for Efficiently Computing Matrix Exponential.

Just use randi, e.g., >> k=8; M = triu(randi(10,k,k)) M = 9 10 5 7 3 5 8 10 0 10 ...

14 Tage ago | 0

Answered

How can I extrapolate the value for the slope of the line?

You could do, p=polyfit(log(x),log(y),1); slope=p(1);

How can I extrapolate the value for the slope of the line?

You could do, p=polyfit(log(x),log(y),1); slope=p(1);

14 Tage ago | 0

| accepted

Answered

How to store sequence of bits as a bit stream and use the least possible memory ?

You could chain all your strings together as a logical column vector and use bwpack, see https://www.mathworks.com/help/images/...

How to store sequence of bits as a bit stream and use the least possible memory ?

You could chain all your strings together as a logical column vector and use bwpack, see https://www.mathworks.com/help/images/...

14 Tage ago | 0

Answered

calculate rotation matrix in 3D

B1=[axis_1/norm(axis_1);axis_2/norm(axis_2);axis_3/norm(axis_3)]; B2=[dir1_new(:),null(dir1_new)]; s=sign(det(B2)); B2=...

calculate rotation matrix in 3D

B1=[axis_1/norm(axis_1);axis_2/norm(axis_2);axis_3/norm(axis_3)]; B2=[dir1_new(:),null(dir1_new)]; s=sign(det(B2)); B2=...

14 Tage ago | 0

Answered

How to I convert a 3D array into 4-column table (x y z value)?

[m,n,p]=size(imgData); [x,y,z]=ndgrid(1:m,1:n,1:p); out=[x(:),y(:),z(:),imgData(:)];

How to I convert a 3D array into 4-column table (x y z value)?

[m,n,p]=size(imgData); [x,y,z]=ndgrid(1:m,1:n,1:p); out=[x(:),y(:),z(:),imgData(:)];

15 Tage ago | 0

| accepted

Answered

Correct Interpolation on a pre-calculated grid that is a vector function of a vector?

so that I can query at points (Gx_q, Gy_q, Gz_q) and find their (x,y,z) inputs that give G. But there may exist no such point ...

Correct Interpolation on a pre-calculated grid that is a vector function of a vector?

so that I can query at points (Gx_q, Gy_q, Gz_q) and find their (x,y,z) inputs that give G. But there may exist no such point ...

15 Tage ago | 0

Answered

interp1 gpuArray bug

The bug appears to have been fixed in R2019b: >> A=rand(80,2); >> interp1((1:80)', A, gpuArray(((1:2))')) ans = 0.60...

interp1 gpuArray bug

The bug appears to have been fixed in R2019b: >> A=rand(80,2); >> interp1((1:80)', A, gpuArray(((1:2))')) ans = 0.60...

15 Tage ago | 0

| accepted

Answered

Solve equationsystem (A*V).'*B*(A*V)=C for matrix A

for a first solution we could assume A is diagonal. An iterative solution: fun=@(a) objective(a,B,C,V); a=lsqnonlin(fun, on...

Solve equationsystem (A*V).'*B*(A*V)=C for matrix A

for a first solution we could assume A is diagonal. An iterative solution: fun=@(a) objective(a,B,C,V); a=lsqnonlin(fun, on...

16 Tage ago | 0

Answered

Solve equationsystem (A*V).'*B*(A*V)=C for matrix A

Looks like it would just be, A = sqrtm(B)\sqrtm(C)/V;

Solve equationsystem (A*V).'*B*(A*V)=C for matrix A

Looks like it would just be, A = sqrtm(B)\sqrtm(C)/V;

16 Tage ago | 0

Answered

How to define coordinates of orientated BoundingBox for every case?

How about if you find the centroid (ic,jc) of each region and then identify the bounding box corner (i,j) satisfying the conditi...

How to define coordinates of orientated BoundingBox for every case?

How about if you find the centroid (ic,jc) of each region and then identify the bounding box corner (i,j) satisfying the conditi...

16 Tage ago | 0

| accepted

Answered

How to perform multi-planar reformation in CT/MR images?

There is the slice() command. https://www.mathworks.com/help/matlab/ref/slice.html

How to perform multi-planar reformation in CT/MR images?

There is the slice() command. https://www.mathworks.com/help/matlab/ref/slice.html

16 Tage ago | 0

| accepted

Answered

Is there any way I can feed forward a 3D dataset into a neural network?

You could train the network to view the input as 20x65 with N=1658 channels, but it would probably be more practical to break th...

Is there any way I can feed forward a 3D dataset into a neural network?

You could train the network to view the input as 20x65 with N=1658 channels, but it would probably be more practical to break th...

17 Tage ago | 0

Answered

Linearprogramming conditions are unknown

As I mentioned in your previous post, you want to set up the following equivalent LP, I don't think it should be a diff...

Linearprogramming conditions are unknown

As I mentioned in your previous post, you want to set up the following equivalent LP, I don't think it should be a diff...

18 Tage ago | 0

Answered

plot 3-D distribution from a 3-D matrix

As of R2017a, Matlab provides a 3D volume viewer app, https://www.mathworks.com/help/images/ref/volumeviewer-app.html

plot 3-D distribution from a 3-D matrix

As of R2017a, Matlab provides a 3D volume viewer app, https://www.mathworks.com/help/images/ref/volumeviewer-app.html

18 Tage ago | 0

Answered

What capability would you want to see added to the symbolic toolbox in the future?

The ability to manipulate symbolic matrix variables (instead of just matrices of scalar symbolic variables).

What capability would you want to see added to the symbolic toolbox in the future?

The ability to manipulate symbolic matrix variables (instead of just matrices of scalar symbolic variables).

19 Tage ago | 1