Professional Interests: computational physics, applied mathematics

Answered

how to implement the algorithm for approximating Cosine using the Taylor series

syms theta n=4; taylor(cos(theta),'Order',n)

how to implement the algorithm for approximating Cosine using the Taylor series

syms theta n=4; taylor(cos(theta),'Order',n)

1 day ago | 0

| accepted

Answered

Is there any way to accelerate the solving of a series of large sparse positive definite linear equations "Ax=b" with same "A" and different "b"?

It depends... Besides inv(A), you can try A\eye(n), pinv(A)--all of them are equivalent for a well-conditioned A and different ...

Is there any way to accelerate the solving of a series of large sparse positive definite linear equations "Ax=b" with same "A" and different "b"?

It depends... Besides inv(A), you can try A\eye(n), pinv(A)--all of them are equivalent for a well-conditioned A and different ...

8 days ago | 0

Answered

Is there any method to calculate the inverse of matrix which changed a few values?

I am not sure how much profitable it is numerically, but the Sherman Morrison theorem can be a way, see https://en.wikipedia.org...

Is there any method to calculate the inverse of matrix which changed a few values?

I am not sure how much profitable it is numerically, but the Sherman Morrison theorem can be a way, see https://en.wikipedia.org...

11 days ago | 1

Answered

What does ''all'' mean in M = min(A, []. ''all'') ?

All this is fairly well described in the matlab documentation. min(min(A)) and min(A, [], ''all'') are equivalent for 1D and 2D ...

What does ''all'' mean in M = min(A, []. ''all'') ?

All this is fairly well described in the matlab documentation. min(min(A)) and min(A, [], ''all'') are equivalent for 1D and 2D ...

12 days ago | 0

Answered

If I have multiple function, then how can I get the function of min(fun1,fun2,fun3,...)?

xmin=min([R1(x(:)');R2(x(:)');...]); % to get a correct result, the argument must be a row-vector: x(:)' turns any input array t...

If I have multiple function, then how can I get the function of min(fun1,fun2,fun3,...)?

xmin=min([R1(x(:)');R2(x(:)');...]); % to get a correct result, the argument must be a row-vector: x(:)' turns any input array t...

12 days ago | 0

| accepted

Answered

Is there a bug in the if function

This is not a bug in the if function but an artefact of the rounding of the matlab bit-wise arithmetics. To avoid this effect, s...

Is there a bug in the if function

This is not a bug in the if function but an artefact of the rounding of the matlab bit-wise arithmetics. To avoid this effect, s...

13 days ago | 0

Answered

Angle between two lines in frontal plane

If, as it looks in the figure, (...Y) are the verticle coordinates and (...Z) are the horizontal coordinates, then the basic geo...

Angle between two lines in frontal plane

If, as it looks in the figure, (...Y) are the verticle coordinates and (...Z) are the horizontal coordinates, then the basic geo...

13 days ago | 1

| accepted

Answered

solve function give a wrong solution

syms x solv = double(solve( (1+x/12)^12 == 1.02)) There are many solutions. The one you are interested in is rather 0.01981897...

solve function give a wrong solution

syms x solv = double(solve( (1+x/12)^12 == 1.02)) There are many solutions. The one you are interested in is rather 0.01981897...

19 days ago | 0

| accepted

Answered

How to see the current value of the variable in "fminsearch" optimization?

optimset('Display','iter'); From Matlab documentation: 'Display' — Level of display 'notify' (default) | 'final' | 'off' | 'n...

How to see the current value of the variable in "fminsearch" optimization?

optimset('Display','iter'); From Matlab documentation: 'Display' — Level of display 'notify' (default) | 'final' | 'off' | 'n...

19 days ago | 0

Answered

showing the distance between the two plots on two curves at regular intervals on the same plot

t=0:0.2:10; % avoid loops wherenever possible, use element-wise operations instead x=t.^2; y=0.5*x+10; % the same as "y=0.5*t...

showing the distance between the two plots on two curves at regular intervals on the same plot

t=0:0.2:10; % avoid loops wherenever possible, use element-wise operations instead x=t.^2; y=0.5*x+10; % the same as "y=0.5*t...

29 days ago | 0

| accepted

Answered

Writing into .txt file

T = [v angle_random]; % this is if you want a 2-column file save('random_cylind.txt','T','-ascii','-double'); % explore availab...

Writing into .txt file

T = [v angle_random]; % this is if you want a 2-column file save('random_cylind.txt','T','-ascii','-double'); % explore availab...

1 month ago | 0

| accepted

Answered

Debugging using external editor

https://www.mathworks.com/help/matlab/matlab_external/debugging-on-microsoft-windows-platforms.html

Debugging using external editor

https://www.mathworks.com/help/matlab/matlab_external/debugging-on-microsoft-windows-platforms.html

1 month ago | 0

Answered

How do I record the location of a specific value in a set of data?

a=[0 0 0 0 1 0 1 0 0]; k=find(a==1,1)

How do I record the location of a specific value in a set of data?

a=[0 0 0 0 1 0 1 0 0]; k=find(a==1,1)

2 months ago | 0

Answered

How to Convert 3d matrix to row matrix???

a=rand(2,2,2) % a sample 3D matrix a b=a(:)' % is turned to the 1D row matrix b

How to Convert 3d matrix to row matrix???

a=rand(2,2,2) % a sample 3D matrix a b=a(:)' % is turned to the 1D row matrix b

4 months ago | 2

Answered

Plot the trapeoidal waveform using given equations

syms theta y=piecewise(... 0<=theta<2*pi/3,1,... 2*pi/3<=theta<pi,(1-6/pi*(theta-2*pi/3)),... pi<=theta<5*pi/3,-...

Plot the trapeoidal waveform using given equations

syms theta y=piecewise(... 0<=theta<2*pi/3,1,... 2*pi/3<=theta<pi,(1-6/pi*(theta-2*pi/3)),... pi<=theta<5*pi/3,-...

5 months ago | 0

Answered

How to draw an ellipse

The code discussed at https://www.mathworks.com/matlabcentral/answers/497966-how-to-find-the-vertical-height-of-an-ellipse-y-axi...

How to draw an ellipse

The code discussed at https://www.mathworks.com/matlabcentral/answers/497966-how-to-find-the-vertical-height-of-an-ellipse-y-axi...

6 months ago | 0

Answered

Eigenvalues corresponds to eigenvectors

Absolutely standard: L(k,k) ~ V(:,k). You can check it with the code: for k=1:size(h,1) disp(strcat('k=',num2str(k),'; h*v-la...

Eigenvalues corresponds to eigenvectors

Absolutely standard: L(k,k) ~ V(:,k). You can check it with the code: for k=1:size(h,1) disp(strcat('k=',num2str(k),'; h*v-la...

6 months ago | 0

| accepted

Answered

Subs Command for Multivariable Function

If e^ is the exponent and if you want to estimate the result numerically (from the question it is not quite clear what you want)...

Subs Command for Multivariable Function

If e^ is the exponent and if you want to estimate the result numerically (from the question it is not quite clear what you want)...

6 months ago | 0

Answered

Partial least-squares regression evalutaion

The equation considered in PLS of Matlab is rather Y = X(:,:)*B(2:end,:) + repmat( B(1,:),n,1 ) + E, where: X is an n-by-...

Partial least-squares regression evalutaion

The equation considered in PLS of Matlab is rather Y = X(:,:)*B(2:end,:) + repmat( B(1,:),n,1 ) + E, where: X is an n-by-...

6 months ago | 0

| accepted

Answered

Normalization of complex eigenvector

You probably want V(:,1) = V(:,1)/norm(V(:,1)); Besides, if your theta and phi are supposed to be real, the overall computatio...

Normalization of complex eigenvector

You probably want V(:,1) = V(:,1)/norm(V(:,1)); Besides, if your theta and phi are supposed to be real, the overall computatio...

6 months ago | 0

| accepted

Answered

Eigenvector without calling eigenvalues

This is not an error but a warning that you do not use the eigenvalues, which influences nothing. If you want to avoid it, subst...

Eigenvector without calling eigenvalues

This is not an error but a warning that you do not use the eigenvalues, which influences nothing. If you want to avoid it, subst...

6 months ago | 0

Answered

Can I check if factored and expanded polynomial forms are equal?

simplify((w^2-k^2) - (w+k)*(w-k)) ans = 0 expand((w+k)*(w-k)) ans = w^2 - k^2 factor(w^2-k^2) ans = [ -1, k - w...

Can I check if factored and expanded polynomial forms are equal?

simplify((w^2-k^2) - (w+k)*(w-k)) ans = 0 expand((w+k)*(w-k)) ans = w^2 - k^2 factor(w^2-k^2) ans = [ -1, k - w...

6 months ago | 0

| accepted

Answered

How to call some object handle from opening function of figure?

u0=findobj('Tag','lst1','Style','listbox','Parent',gcf); % search for all the object properties you used to identify it set(u0,...

How to call some object handle from opening function of figure?

u0=findobj('Tag','lst1','Style','listbox','Parent',gcf); % search for all the object properties you used to identify it set(u0,...

6 months ago | 0

| accepted

Answered

Find orthogonal complement for given matrix

B=null(A'); The matrix transposing is important!

Find orthogonal complement for given matrix

B=null(A'); The matrix transposing is important!

6 months ago | 1

| accepted

Answered

How can I write a loop, which can make the parameter "V" change with a cyclic variable "i"?

Use Matlab functions "strcat" and "num2str" within a loop.

How can I write a loop, which can make the parameter "V" change with a cyclic variable "i"?

Use Matlab functions "strcat" and "num2str" within a loop.

7 months ago | 0

| accepted

Answered

How do I calculate acceleration with velocity and the code given?

% sample data t=0:0.1:10; % time x=3+2*t+t.^2; % coordinate [t,ind]=sort(t); % in a case time is not in an ascending order ...

How do I calculate acceleration with velocity and the code given?

% sample data t=0:0.1:10; % time x=3+2*t+t.^2; % coordinate [t,ind]=sort(t); % in a case time is not in an ascending order ...

7 months ago | 0

Answered

How to assign numbers to letters of the alphabet. Ex. A/a=1 B/b=2

The ASCII codes can be found with the function double double('A'); 65 If you want to get its ordinal number in the alphabet, ...

How to assign numbers to letters of the alphabet. Ex. A/a=1 B/b=2

The ASCII codes can be found with the function double double('A'); 65 If you want to get its ordinal number in the alphabet, ...

7 months ago | 0