Community Profile

# Bjorn Gustavsson

### UIT, the Arctic University of Norway

854 total contributions since 2001

View details...

Contributions in
View by

Removing rows in a matrix
If you can determine/calculate all rows you want to remove at once it is best to do the re-sizing of the array at once, instead ...

7 days ago | 0

How to calculate the field on the surface created with Delaunay triangulation?
If you have the magnetic field components at the points [x,y,z] then you should be able to use TriScatteredInterp or (preferably...

8 days ago | 0

Too many output arguments ode23t
Try to change your maxh_d function to explicitly return dxdt: function dxdt = maxh_d(t,x) dxdt = zeros(2,1); % x(1) refers to ...

11 days ago | 0

| accepted

Contour plot size reduction
To get the figures "just right" you might have to manually masage them a little bit. When it comes to colorbars I often have to ...

11 days ago | 0

Reversing/Alternatives of function handles
Some of our mathematic operations does not only depend on calculations of their value at a fixed set of known points. For exam...

11 days ago | 1

Optimal Code Structuring - Global Variables
Matalb allows you to write functions with multiple out-put variables: function [phi_12,l_12] = a_silly_fcn(r1,r2) phi_12 = ata...

12 days ago | 0

Reverse/flip values in the colorbar axis
If you want exactly that colormap, but flip it you can do this: cmp = colormap; cmp = flipud(cmp); colormap(cmp); You shou...

12 days ago | 0

How can I utilise shooting method for following equation
Since you are a matlab-beginner you should first start to work through the introduction material, there are some intro-course-we...

12 days ago | 0

| accepted

Display rgb image in cartesian plane
Previously I've used: tcolor, with good results. HTH

12 days ago | 0

| accepted

Speeding up calculation and removing symbol operation for modelization
You can simply define your model-function something like this: func = @(B,x,y) B(3)*x+B(1)*exp(B(2)./y); There is no reason to...

12 days ago | 0

| accepted

What is the difference between conv2 and imfilter?
The first question is very simple to answer, conv2 has as its default behaviour: 'full' - (default) returns the full 2-D conv...

12 days ago | 0

Dot indexing is not supported for variables of this type.
When you get a problem like this it is because the variable is not of a struct as you expect. In general you can add a line with...

13 days ago | 0

How to close mutiple uifigure using command
If you want to keep some figures you can close a subset of them if you keep the figure-handles in an array. If you modify your c...

13 days ago | 0

Blurred latex figure label
Print your figure to post-script format using the -painters renderer: print('-depsc2','-painters','Your-new-and-pretty-figure-0...

13 days ago | 1

| accepted

Extract data from contour plot of .png file?
In case the conversion of the colormap to grayscale doesn't work well (i.e. multiple colours mapping to the same gray-level) I o...

14 days ago | 0

Any Precondition for the slow decay singular value??
Unfortunately I could not access the paper. However, I'll offer my opinion anyway. Once you've calculated your SVD-decomposition...

14 days ago | 0

| accepted

2 dependent ode45 equation
If you have 2 coupled ODEs: Then it is best to integrate them toghether. If you for some reason cannot do that or your prob...

17 days ago | 2

| accepted

Find the element that is a sqrt of another element in the same array function?
Hint: Which number are you actually comparing, and which number-combinations do you need to compare? One thing I'll suggest is ...

18 days ago | 0

Linear interpolation Using Polyfit
Repeat question. What's missing from the answer I gave you here: Using polyfit for linear regression? Perhaps explicitly telli...

19 days ago | 0

Vertical concatenation of structure fields (compact form)
This gets you to a 2-by-suitable char array: char(structure.field) But this will obviously not be a general solution for field...

19 days ago | 2

Using polyfit for linear regression
Your code looks OK. Your problem might be that you expect a result identical to the figure from the documentation. However, you...

19 days ago | 0

Submitted

Scrollsubplot
scrollsubplot(n,m,p) p<0 and p>nm, Extends subplot to infinite canvas ...

Submitted

check4nameclashes
checks for name-clashes between m-files found in a directory and its subdirectories and files in directories on the the current ...

Changing a double type cell in "HH:MM:SS" format.
Well you get an output from datestr: datestr(4.099215427200000e+09,'yyyy mm dd HH:MM:SS') ans = '3270 08 21 04:47:59' Yo...

20 days ago | 1

Symbolic sin(pi) in Matlab 2020 a not simplify
That is because your definition of pi as a symbolic variable that hides the built-in pi. Try: which pi -all or: sym x pi = 4...

21 days ago | 1

How can I solve the following derative problem in Matlab ?
When you assign: t = -1; t becomes a standard double scalar, and is no longer a symbolic variable. So that's where you go comp...

22 days ago | 0

| accepted

Problem with the latex eps format
When you write to postscript-format matlab (still) makes "clever" choises about how to write the file. Try to enforce vectorized...

23 days ago | 1

| accepted

converting from sym to double
Most of the time I want to convert a symbolic expression to something else I use matlabFunction: syms s x real f = int(cos(s^2...

23 days ago | 0

How can I solve non-linear differential equations?
The ODE-integrating functions of matlab are well suited to solve this kind of problems. Have a look at the help and documentatio...

23 days ago | 0