I have a MSc in physics from the University of Oslo and a PhD in control engineering from NTNU in Trondheim (mainly modelling, I am not much of a control engineer). My main interests are mathematical modelling, numerical methods, and thermodynamics. I worked in the petroleum and chemical process industries for some 35 years and I am now semi-retired

Solved

Covering area

As an extension of the problem <http://www.mathworks.com/matlabcentral/cody/problems/416-polygon-area>, find the area, bounded b...

22 hours ago

Solved

What is the distance from point P(x,y) to the line Ax + By + C = 0?

Given a point, P(x,y), find the distance from this point to a linear line. INPUTS: x, y, A, B, C OUTPUTS: d, the distance ...

24 hours ago

Solved

Is the Point in a Circle?

Check whether a point or multiple points is/are in a circle centered at point (x0, y0) with radius r. Points = [x, y]; c...

2 days ago

Solved

Spherical radius given four points

Determine the radius of a sphere provided four non-coplanar points on the surface of the sphere. pts = [x1 y1 z1; x...

2 days ago

Answered

How to plot a trinomial graph

fun = @(x) x^3; fplot(fun,[-3,3]) Alternatively: x = linspace(-3,3); plot(x,x.^3); % Note the use of .^, for element by ele...

How to plot a trinomial graph

fun = @(x) x^3; fplot(fun,[-3,3]) Alternatively: x = linspace(-3,3); plot(x,x.^3); % Note the use of .^, for element by ele...

4 days ago | 0

Solved

Volume of a Parallelepiped

Calculate the volume of a Parallelepiped given the vectors for three edges that meet at one vertex. A cube is a special case ...

6 days ago

Solved

Are all the three given point in the same line?

In this problem the input is the coordinate of the three points in a XY plane? P1(X1,Y1) P2(X2,Y2) P3(X3,Y3) how can...

7 days ago

Solved

Television Screen Dimensions

Given a width to height ratio of a TV screen given as _w_ and _h_ as well as the diagonal length of the television _l_, return t...

8 days ago

Solved

Angle between Two Vectors

The dot product relationship, a dot b = | a | | b | cos(theta), can be used to determine the acute angle between vector a and ve...

8 days ago

Solved

Clockwise or Counterclockwise

Given a list of 2-d points defining the vertices of a polygon, determine whether these points are sorted clockwise. The input...

9 days ago

Solved

Find third Side of a right triangle given hypotenuse and a side. No * - or other functions allowed

Find the remaining side of a triangle given the hypotenuse and a side. However, the normal functions and symbols are not allowe...

9 days ago

Solved

Multiply 2 numbers

Very easy, you just have to multiply 2 numbers but you cannot use the following signs (*, /, - ,^) ,mtimes , times, cross, pro...

15 days ago

Solved

Is the Point in a Triangle?

Check whether a point or multiple points is/are in a triangle with three corners Points = [x, y]; Triangle = [x1, y1; x...

16 days ago

Solved

Right Triangle Side Lengths (Inspired by Project Euler Problem 39)

If _p_ is the perimeter of a right angle triangle with integral length sides, { _a_, _b_, _c_ }, there are exactly three solutio...

16 days ago

Solved

Find my daddy long leg (No 's')

Given the ratio of the two legs (longer / shorter), and the hypotenuse length, find the value of the bigger leg.

16 days ago

Solved

Side of an equilateral triangle

If an equilateral triangle has area A, then what is the length of each of its sides, x? <<https://i.imgur.com/jlZDHhq.png>> ...

16 days ago

Solved

Calculate the area of a triangle between three points

Calculate the area of a triangle between three points: P1(X1,Y1) P2(X2,Y2) P3(X3,Y3) these three points are the vert...

16 days ago

Solved

Can we make a triangle?

Given three positive number, check whether a triangle can be made with these sides length or not. remember that in a triangle su...

17 days ago

Answered

Fitting a 3D gaussian to a 3D matrix

meshgrid arranges the xx and yy output matrices to fit the convention where the surface plots have x on the horizontal axis and ...

Fitting a 3D gaussian to a 3D matrix

meshgrid arranges the xx and yy output matrices to fit the convention where the surface plots have x on the horizontal axis and ...

18 days ago | 0

Solved

First non-zero element in each column

For a given matrix, calculate the index of the first non-zero element in each column. Assuming a column with all elements zero ...

21 days ago

Solved

Specific Element Count

Given a vector _v_ and a element _e_, return the number of occurrences of _e_ in _v_. Note: NaNs are equal and there may be n...

21 days ago

Solved

"Low : High - Low : High - Turn around " -- Create a subindices vector

Let two vectors *lo* and *hi* be given. The job is to create a index vector like so idx = [lo(1):hi(1) lo(2):hi(2) ...]...

22 days ago

Solved

Return elements unique to either input

Given two numeric inputs a and b, return a row vector that contains the numbers found in only a or only b, but not both. For ex...

22 days ago

Solved

middleAsColumn: Return all but first and last element as a column vector

Given input A, return all but the first and last elements, arranged as a column vector. (I.e., all dimensions after the first s...

22 days ago

Solved

Matrix indexing with two vectors of indices

Given a matrix M and two index vectors a and b, return a row vector x where x(i) = M(a(i),b(i)).

22 days ago

Solved

Getting logical indexes

This is a basic MATLAB operation. It is for instructional purposes. --- Logical indexing works like this. thresh = 4...

22 days ago

Solved

Reindex a vector

You are given two vectors of equal length. Vector N has numeric values (no Inf or NaN) while vector IDX has integers. Place th...

22 days ago

Solved

Set the array elements whose value is 13 to 0

Input A either an array or a vector (which can be empty) Output B will be the same size as A . All elements of A equal to 13...

22 days ago

Solved

Fill a zeros matrix

The aim is to fill an array of all zeros given a numerical value and the index of row and columns for this value. 3 Inputs: ...

22 days ago

Solved

Remove the two elements next to NaN value

The aim is to *remove the two elements next to NaN values* inside a vector. For example: x = [6 10 5 8 9 NaN 23 9 7 3 21 ...

22 days ago