Community Profile

photo

Bjorn Gustavsson


Last seen: Today

UIT, the Arctic University of Norway

416 total contributions since 2015

Contact

Bjorn Gustavsson's Badges

  • Explorer
  • 12 Month Streak
  • Knowledgeable Level 4
  • Pro
  • First Review
  • Revival Level 1
  • First Answer

View details...

Contributions in
View by

Answered
ode solver returns too many results
When you get an error in matlab instantly set the debugger on: dbstop if error then rerun the command that caused the error, t...

12 Tage ago | 1

Answered
How to plot three functions in three separate figures and simultaneously in one figure but in three different windows of the same figure?
When you create figures you can do something like this: fig1 = figure; fig2 = figure; fig3 = figure; Then when you want to p...

12 Tage ago | 0

Answered
Generation of random numbers in batches
if you know from the start how many point in each set just do something like: a2 = randn(1,num_points_in_a2); a = a2(1:min(num...

15 Tage ago | 0

Answered
Animated X, Y scatter plot
Have you tried to look at scatter? That should let you do this simply like this: for i1 = 1:10:(numpoints-10), plot(xP(1:i...

16 Tage ago | 0

| accepted

Answered
Why can't OCR detect the text in this photo?
It seems to have something to do with automatic thresholding. If I cut out most of the black background it seems to work just fi...

18 Tage ago | 0

| accepted

Answered
solve differential equation with matrix
Yes your system of ODEs are on the form (with singular mass-matrix, C) that ode23t and ode15s can handle, at least according to ...

18 Tage ago | 0

Answered
Matrix integral over layers
For this I would try cumtrapz - it calculates the cumulative (sp?) trapezoidal integral in the same manner as cumsum calculates ...

18 Tage ago | 0

Answered
Matlab shrinking subplot graphs when running the code
Sometimes that (used to) happen, as far as I understood it had something to do with repeated plotting (possibly with titles and ...

20 Tage ago | 0

Answered
Pcolor equivalent for 3D array
The type of plot you've presented is easily reproduced by this: [x,y,z] = meshgrid(0:3,0:4,0:5); F = floor(4*rand(size(x))); ...

23 Tage ago | 0

| accepted

Answered
Pcolor equivalent for 3D array
For visualization of 3-D data matlab has a couple of builtin functions: slice, scatter3 and isosurface. They does tasks at least...

24 Tage ago | 0

Answered
How to create multiple files with given one file name
I'd do something like this: fn = '/some/where/output.csv'; [pth,nmn,ext] = fileparts(fn); nnmn = fullfile(pth,[nmn,'_std',ext...

25 Tage ago | 0

| accepted

Answered
How to ensure that dsolve provides a trigonometric solution to a second order differential equation?
Since you have a linear ODE with a right-hand-side composed of harmonic terms you know that you can solve for the homogenous and...

25 Tage ago | 0

| accepted

Answered
Asymmetric spring with two different stiffnesses
Yeah, I think that should be the correct test. In the modeling you do you have rather big difference in spring constant. When I ...

27 Tage ago | 1

| accepted

Answered
Solving differential equation with parameters takes forever
If both x and theta varies with t you cannot solve one first and the other separately later, you should treat them as a system o...

27 Tage ago | 1

| accepted

Answered
Code initiates again after exiting while loop which is within an if statement
In your outer for-loop you use you use i as loop-index. The way matlab has implemented things this is done (IIRC) such that ther...

27 Tage ago | 0

| accepted

Answered
Asymmetric spring with two different stiffnesses
ODE45 takes a function, f(t,y), describing the differential equation. You have a differential equation something like this w...

29 Tage ago | 0

Answered
I was wondering if this code could be vectorized, and if so, can it be done without conditionals or loops? It would be great if the vectorized form could be written out so that I could run and follow
Sure, you could generate 2 coordinate matrices x and y with meshgrid: nPix = 66; [x,y] = meshgrid(1:nPix); Then you'll have t...

29 Tage ago | 2

Answered
Error: "SVD does not support sparse matrics. Use SVDS to compute a subset of the singular values and vectors of a sparse matrix." while training SOM.
It means that your SOM-training function somewhere uses (or tries to use) the svd function. That function expects a full matrix,...

29 Tage ago | 0

| accepted

Answered
Why do colors "gray out" when I save figure as .eps
Ah, from the way your figure looks, it seems the "error-shade" function you use uses alpha-blending - that is colour-patches tha...

etwa ein Monat ago | 0

Answered
1-D Transient Heat Conduction With No Heat Generation [FDM] [Crank-Nicholson]
My suggestion is that you add a line: Tall(:,k) = Tb; at the end of your "time-step"-loop. Then after you're done with it all...

etwa ein Monat ago | 1

Answered
Transposing matrices of a Dataset
Take a look at the help and documentation of the matlab-function permute. HTH

etwa ein Monat ago | 0

Answered
Inversion of block tridiagonal matrices
If you have a small enough problem which is not ill-conditioned just use \, if it is ill-conditioned but you can do an SVD of yo...

etwa ein Monat ago | 0

| accepted

Answered
Matlab is installed in ubuntu but i am unable to open it
If you try to execute something like ./matlab from your terminal you tell the shell to run an executable command "matlab" in the...

etwa ein Monat ago | 1

Answered
How to find peaks of the given signal and find the phase shift with respect to the Oscillator 1 signal?
If you had regularly sampled data (it doesn't seem so) this would best be done with spectrogram. That would give you the spectro...

etwa ein Monat ago | 0

Answered
How to solve the reduced eigenvalue poblem
Have a look at the eig function. It solves for eigenvalues-eigenvectors - also for the generalized eigenvalue-problem you seem t...

etwa ein Monat ago | 0

Answered
Plot signal from fits file?
To read data in fits-format you can use fitsread and fitsinfo, but when I try that on an image from SETI-projects web-site I got...

etwa ein Monat ago | 0

Answered
How to make a plot with x-axis that has different scales on different specific regions?
Either you can use something like set(gca,'xscale','log') if that brings you close enough. If you want to plot on some other ...

etwa ein Monat ago | 1

| accepted

Answered
Avoid ''Dot indexing is not supported for variables of this type.'', exist(...) isn't working
If you want to check if a struct has a field your're interested in you should check with isfield, check the help and documentati...

etwa ein Monat ago | 0

Answered
editing the JET colormap
You should be able to do something like this: imagesc(peaks(123)) cx = caxis; n_colors = 128 cmp = jet(n_colors); colorbar ...

etwa ein Monat ago | 1

| accepted

Answered
How can I check that a newly generated sequence is already in the existing structure list or not?
For example this can be used: intersect([1 2 3;1 3 2;2 1 3;2 3 1;3 1 2],[3 2 1],'rows') % %ans = % % 0x3 empty double matr...

etwa ein Monat ago | 0

Load more