Community Profile

Per Sundqvist


Chalmers Tekniska Högskola

335 total contributions since 2004

Professional Interests: quantum and mathematical physics

Contact

Contributions in
View by

Posted


ignore any kind of errors in a loop?
I have a loop that calculates a lot of data based on datafiles it reads. Now it happens that the files sometimes gives very odd ...

5 years ago | 12538 views

Responded


Re: 3d Rectangualr Grid
n=20; x=linspace(-1,1,n); [X,Y]=meshgrid(x,x); r0=1.01; ix=find(X.^2+Y.^2<r0^2); X=X(ix);Y=Y(ix); plot(X(:),Y(:),'.');axis equal...

7 years ago | 5109 views

Responded


Re: 3d Rectangualr Grid
You said rectangular grid. A cylinder is a body with fixed cross-section elongated along ,lets say the z-direction. Do you want ...

7 years ago | 5109 views

Responded


Re: 3D model of banana
If you modify the PlotTube function a little (see below) http://www.mathworks.com/matlabcentral/fileexchange/5562-tubeplot I ca...

7 years ago | 10645 views

Responded


Re: 3D model of banana
look at: http://www.mathworks.com/matlabcentral/fileexchange/5562-tubeplot or mine: http://www.mathworks.com/matlabcentral/file...

7 years ago | 10645 views

Responded


Re: 3d Rectangualr Grid
What about: xmin=0;xmax=1;Nx=10; xvec=linspace(xmin,xmax,Nx); yvec=xvec;zvec=5*xvec; %change here [x,y,z] = ndgrid(xvec,yvec,zv...

7 years ago | 5109 views

Responded


Re: eigen value in finite field
Have no idea what finite field means in your case, but suspect your field is discrete or something? Generally you should not exp...

7 years ago | 2145 views

Responded


Re: To differentiate Bessel function of the second kind
besseli does, but besselk does not, or more generally it depend. K could be defined in two ways, one for which recurrance relati...

7 years ago | 4966 views

Responded


Re: 3d Rectangualr Grid
try: help ndgrid /Per

7 years ago | 5109 views

Responded


Re: Skewing a 2D grid to fit experimental data
Try the interpolation: help griddata /Per

8 years ago | 2732 views

Responded


Re: Double exponential decay fit
Hi, I think my function exp2fit could do it very well: http://www.mathworks.com/matlabcentral/fileexchange/21959 ,but sometime...

8 years ago | 21831 views

Responded


Re: How to solve TA = BT
T=0 is an obvious solution. If you write a vector t=[t11 t12 t13 ...t44]', then you could show that your equation for T is: C*t...

8 years ago | 6430 views

Responded


Re: PDE toolbox
Hi,this cannot be done in pdetool, but in COMSOL multiphysics. There you can assert boundary conditions on internal boundaries, ...

8 years ago | 1708 views

Responded


Re: surface charge, volume energy
Hi, I'm not sure this can be done automatic in PDEtoolbox, but if you could export the solution to matlab workspace you could ev...

8 years ago | 1728 views

Responded


Re: Sparse matrices and eig function
Ok, lets do this slowly. Are there any elements in A or B that are NaN? If not I cannot see why det(...) should give you NaN, si...

8 years ago | 14417 views

Responded


Re: Sparse matrices and eig function
Hi, I'm sorry I didn't see all your information. You could specify if the matrix is symmetric in options but you know that alrea...

8 years ago | 14417 views

Responded


Re: Sparse matrices and eig function
A hint: help eigs /Per

8 years ago | 14417 views

Responded


Re: add random variance to a vector
Its not very clear what you mean. Are min max absolute limits for all vectors? Whats the distribution of V1? Try scaling of the ...

8 years ago | 619 views

Responded


Re: Can you help me plot Chen's chaos equeation.
Hmm, it should be: M=[0 1 0;0 0 1;0 -1 -A]; fun = @(t,y) M*y+[0;0;-1.2+2*sign(y(1))] where y(1)=x, y(2)=x'(t) y(3)=x''(t) Goo...

8 years ago | 1628 views

Submitted


Exponential fit, without start-guess
Fits 1) f=s1+s2*exp(-t/s3) or 2) f=s1+s2*exp(-t/s3)+s4*exp(-t/s5) to numerics, without startguess

8 years ago | 10 downloads |

Thumbnail

Responded


Re: Out of memory for function eig with large matrix eigenvalue
Are you sure your matrix is not sparse? i.e., a lot of elements are=0? Try using sparse and then also eigs, specially suited for...

8 years ago | 8653 views

Responded


Re: double integral
Looks like a problem in spherical coordinates. I also suspect that the integrand is anti-symmetric in cartesian coordinates, why...

8 years ago | 1195 views

Responded


Re: what to use instead of fsolve?
typically x^2-y^2 should be Cosh Sinh the exponetioal version of cos^2+sin^2=1, thus using mathematica: equ1 = a1*x1*x2 + a2*x3*...

8 years ago | 2786 views

Responded


Re: fsolve using only integer values...
First. Is it a minimization problem from the beginning? i.e., you take the derivative of that function w.r.t the two parameters=...

8 years ago | 4737 views

Responded


Re: How to do vectorize this simple code?
This works, but its not so obvious and simple as it should be M=rand(4) row=(1:3); col=(2:4); y=diag(M(row,col)) /Per

8 years ago | 1896 views

Responded


Re: problem with creating function
If its a simple function you could write it directly in your program (you don't have to save it as .m), using "@". Also use "." ...

8 years ago | 571 views

Responded


Re: contours and mat files
Hi again, I think this is what you can do. The new matrix I2 is of the size you want and the color is discretized into an arbitr...

8 years ago | 1622 views

Responded


Re: mesh on a triangle
mesh2d.m not found. -- A sloppy way, if you could live with some edges in the figure: clear all;clc;clf reset n=20; u=linspace...

8 years ago | 4450 views

Responded


Re: contours and mat files
Hi, Sound like an interesting problem. So essentially you want to find "levels of color", right? In gray scale its just scalar s...

8 years ago | 1622 views

Responded


Re: Mathematica to Matlab - File conversion
In Mathematica there is a function called ToMatlab[], but your friend has to download it and then put in the content there and c...

8 years ago | 17138 views

Load more