Community Profile

photo

Bjorn Gustavsson


Last seen: Today

UIT, the Arctic University of Norway

1,022 total contributions since 2001

Contact

Bjorn Gustavsson's Badges

  • Revival Level 2
  • 24 Month Streak
  • First Submission
  • Explorer
  • 5-Star Galaxy Level 5
  • Knowledgeable Level 4
  • Personal Best Downloads Level 2
  • Pro
  • Editor's Pick
  • First Review
  • Thankful Level 1
  • First Answer
  • Solver

View details...

Contributions in
View by

Answered
unable to solve non linear differential equation
This looks like an equation of the form: Unless you have an equation for a trajectory of a spinning object falling in gravity...

2 hours ago | 0

Answered
Solving system of ODEs with ode45 and multiple time dependent variables
In your ODE-fun you can "simply" interpolate your time-dependent coefficients. Something like this: function dTdt = ODEfun(t,T,...

14 hours ago | 1

| accepted

Answered
How to make a matrix of all zeros be the same size as a data set being used?
Something like this: u = zeros(size(v)); HTH

16 hours ago | 1

| accepted

Answered
Constrained optimization, free code
There ought to be some optimization-tools on the file-exchange that can be used instead of fminsearch. Perhaps the minimize tool...

21 hours ago | 0

Answered
2D DFT of an image
OK, here's a solution that's computationally useless since 1965: szIm = size(Im); M1 = dftmtx(szIm(1)); M2 = dftmtx(szIm(2));...

22 hours ago | 0

Answered
Why is Matlab changing thickness of the line in this plot ?
input4 and input5 have circle and triangle set as marker. I can't see where that happens, but try to un-set that. Something like...

23 hours ago | 0

| accepted

Answered
Eigen Vectors and Values using Matlab
Why not calculating the eigenvectors at once? [Ev,lambda]=eig(A) Also, when rounding the eigenvalues, you're no longer guarant...

1 day ago | 1

Answered
Diagonal Interpolation/Extrapolation of a 1024 x 30 Matrix
What you can try for this is to align the main peaks, using something like this: [~,idxPeaks] = max(I_spectras,[],2); % Here I ...

1 day ago | 0

Answered
Converting Linear Equations to Matrix Form
Is k some sort of propagation (time? space?) index and you want to convert these equations into a matrix-format, or are these ac...

2 days ago | 0

Answered
Save multiple image automatically
You simply have to generate a sequence of unique filenames to save to. Something like this: outfile = fullfile(outfolder, s...

2 days ago | 0

| accepted

Answered
Cell to mat conversion
If you want to extract the content of one cell simply do: b = a{1}; If you want to merge a couple of cells into an array or ma...

2 days ago | 0

| accepted

Answered
interp2 error non monotonus
It should (big claim, I know) be as simple as: torque = data(2:end,1); rpm = data(1,2:end); eff_epk = data(2:end,2:end); Nm ...

4 days ago | 2

| accepted

Answered
How to make subplots scroll at the same time?
See the help and documentation for linkaxes (and possibly linkprop). I'd do something like this: %Create subplot sph1 = subplo...

4 days ago | 0

| accepted

Answered
how to vectorise or speed up the specific code
Newton says you can cut it in two if you take into account that the force from particle i on particle j is equal but directed in...

7 days ago | 2

Answered
Why `sparse` function accumulate large sparse COO format matrix by index so fast?
Because sparse is a built-in function that Mathworks most likely have spent many man-months (we wouldn't know) on optimizing. Yo...

7 days ago | 0

Answered
How to create null vector Matlab
First off if you've done something like: N = 12; M = 14; K = 7; Mtr = randn(M,N); V = rand(1,K); V=zeros(1,length(N)-lengt...

8 days ago | 0

| accepted

Answered
i need to save images with different file names in seperate folders
You can do this, as Jan hinted at, something like this: faces = 1:6 face_names = {'top','bottom','front','back','left','right'...

10 days ago | 1

Answered
how to make a covarinace matrix using data from excel?
Just use cov. From the help of the cov-function: cov Covariance matrix. cov(X), if X is a vector, returns the variance. F...

10 days ago | 0

Answered
How to make ticks labels (the numbers, not the axis labels.) bold when using latex interpreter.
This seems to work in general: set(gca,'fontweigth','bold') HTH

10 days ago | 0

Answered
Average intensity as a function of angle in 2D FFT plot
This is kind-of-difficult in practice. Your fft has low-wavenumber components at [0,0], [1,0], [-1, 0], [0,1], [0,-1] and if we ...

11 days ago | 1

Answered
for loop with vectors having different sizes
To fool-proof your concatenation, and to generate better directory-names you could do something like this: a = [1 2]; b = [3 4...

14 days ago | 0

Answered
Instantaneous Velocity from Displacement and Time values
There are busloads of things you could try: interpolate to a denser time-grid (using 'phcip' or 'spline' for interpolation metho...

14 days ago | 0

Answered
How to specify correct fontsize of text according to plot boundary coordinates
This is the best I can think of: th = text(-10.05,0.94,'Hello WORLD!'); % Some text-coordinate in a figure of mine txt_size = ...

14 days ago | 0

| accepted

Answered
Airy equation with ode solver
That is just a scaling-factor off. (in addition to some numerical issues around the zero-crossings.) This comes about because of...

15 days ago | 1

| accepted

Answered
Warning: Solution does not exist because the system is inconsistent.
Have a look at the equations. If you rewrite them you will get: Bw1 = ( b1 + b2 ) * 2*cos(2*w1) + b3 == 0; Bw2 = ( b1 + b2 ) *...

15 days ago | 1

| accepted

Answered
Drawing a Tangent to a Spline
When you calculate the gradient: m = gradient(yq, xq); Then your m will have the same dimension as your xq and yq arrays. So w...

15 days ago | 0

Answered
MOUSE DOUBLE CLICK PROBLEM
Once I wrote an image-processing tool where I wanted to use all 4 mouse-button events - but it seemed as if the double-click eve...

15 days ago | 0

Answered
How do I create a 3D response surface plot(Contour Plot) from X Y Z C points ?
That plot looks like it would be reproducible with scatter3. So have a look at the help and documentation of that function. One ...

17 days ago | 0

Answered
Convolving 2D image with 1D filter
That works for imagesc of doubles: I2 = peaks(123); h = [0 0 0 1]; imagesc(I2) pause(0.5) imagesc(conv2(I2,h,'same')) Did ...

18 days ago | 0

Load more