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

Divisible by 6

Pursuant to the <http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem> in this series, this o...

ungefär 18 timmar ago

Solved

Divisible by 5

Pursuant to the <http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem> in this series, this o...

ungefär 18 timmar ago

Solved

Divisible by 4

Pursuant to the <http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem> in this series, this o...

ungefär 18 timmar ago

Solved

Divisible by 3

Pursuant to the <http://www.mathworks.com/matlabcentral/cody/problems/42404-divisible-by-2 first problem> in this series, this o...

ungefär 21 timmar ago

Solved

Divisible by 2

This is the first problem in a set of "divisible by x" problems. You will be provided a number as a string and the function you ...

ungefär 22 timmar ago

Solved

(Linear) Recurrence Equations - Generalised Fibonacci-like sequences

This problem is inspired by problems <http://uk.mathworks.com/matlabcentral/cody/problems/2187-generalized-fibonacci 2187>, <htt...

2 dagar ago

Solved

Fibonacci Decomposition

Every positive integer has a unique decomposition into nonconsecutive Fibonacci numbers f1+f2+ ... Given a positive integer n, r...

2 dagar ago

Solved

How many Fibonacci numbers?

Find the number of unique Fibonacci numbers (don't count repeats) in a vector of positive integers. Example: x = [1 2 3 4...

2 dagar ago

Solved

Fibonacci-Sum of Squares

Given the Fibonacci sequence defined by the following recursive relation, * F(n) = F(n-1) + F(n-2) * where F(1) = 1 and F(1)...

2 dagar ago

Solved

Project Euler: Problem 2, Sum of even Fibonacci

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 te...

2 dagar ago

Solved

Return fibonacci sequence do not use loop and condition

Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: ...

2 dagar ago

Solved

Find the next Fibonacci number

In the sequence of Fibonacci numbers, every number is the sum of the two preceding ones: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55...

2 dagar ago

Solved

Return the Fibonacci Sequence

Write a code which returns the Fibonacci Sequence such that the largest value in the sequence is less than the input integer N. ...

2 dagar ago

Solved

Sum of first n terms of a harmonic progression

Given inputs a, d and n, return the sum of the first n terms of the harmonic progression a, a/(1+d), a/(1+2d), a/(1+3d),....

3 dagar ago

Solved

Make an anonymous function that has variable output

Make a anonymous function that has variable output. f = @(x)... the following equation→equation(s) as followed has(ve) ...

3 dagar ago

Solved

Project Euler: Problem 7, Nth prime

By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the Nth prime nu...

3 dagar ago

Solved

Alphabetize by last name

Given a list of names in a cell array, sort the list by the last name. So if list = {'Barney Google','Snuffy Smith','Dagwood ...

3 dagar ago

Solved

Kaprekar Steps

6174 is the <http://en.wikipedia.org/wiki/6174_%28number%29 Kaprekar constant>. All natural numbers less than 10,000 (except som...

4 dagar ago

Answered

Error using + Matrix dimensions must agree.

In line 43, x(:,i) is a column vector, while k1' is a row vector. Summing a column vector and a row vector is not allowed in ol...

Error using + Matrix dimensions must agree.

In line 43, x(:,i) is a column vector, while k1' is a row vector. Summing a column vector and a row vector is not allowed in ol...

8 dagar ago | 0

Answered

Golden Section Search algorithm, golden number why is 0.381

Let and be the end points of the current range. In golden ratio search we choose a new point such that the ratio of the two ...

Golden Section Search algorithm, golden number why is 0.381

Let and be the end points of the current range. In golden ratio search we choose a new point such that the ratio of the two ...

ungefär en månad ago | 1

Answered

Problem relating to mathematical expression

Ameer's answer is correct, of course. Here is another approach, without the elegant Matlab functions: N = 5; % Max window size...

Problem relating to mathematical expression

Ameer's answer is correct, of course. Here is another approach, without the elegant Matlab functions: N = 5; % Max window size...

ungefär 2 månader ago | 0

Answered

Help text does not work for user-defined functions

Problem solved - finally! My Matlab 2019b and 2020a installations had several other odd behaviours in addition to the help prob...

Help text does not work for user-defined functions

Problem solved - finally! My Matlab 2019b and 2020a installations had several other odd behaviours in addition to the help prob...

ungefär 2 månader ago | 2

| accepted

Answered

Solution for system of two non linear equation

You can rewrite you equations as (Nd-x-y)-a*(x*(x+y)) = 0 (Nd-x-y)*(No-y)-b*(y*(x-y)) = 0 where x = Nd, y = Nonegative, a = ...

Solution for system of two non linear equation

You can rewrite you equations as (Nd-x-y)-a*(x*(x+y)) = 0 (Nd-x-y)*(No-y)-b*(y*(x-y)) = 0 where x = Nd, y = Nonegative, a = ...

ungefär 2 månader ago | 1

| accepted

Answered

Problem of erf when using fmincon

Your problem has infinitely many solutions. Whenver x(1)-x(3) = 1 and x(2)-x(4) = 1, fun = 0, which is the minimum value possib...

Problem of erf when using fmincon

Your problem has infinitely many solutions. Whenver x(1)-x(3) = 1 and x(2)-x(4) = 1, fun = 0, which is the minimum value possib...

ungefär 2 månader ago | 0

Answered

how to Nonlinear equations?(two variables)

Although R1 and R2 are nonlinear finctions of t, your equations are linear in x. So you write the equations on the form A(t)*...

how to Nonlinear equations?(two variables)

Although R1 and R2 are nonlinear finctions of t, your equations are linear in x. So you write the equations on the form A(t)*...

2 månader ago | 2

| accepted

Answered

How to count number of times a number appears in column B based on column A

letters = 'ABAACD'; numbers = [1,2,2,1,1,3]; uniqueletters = unique(letters); uniquenumbers = unique(numbers); n = length(un...

How to count number of times a number appears in column B based on column A

letters = 'ABAACD'; numbers = [1,2,2,1,1,3]; uniqueletters = unique(letters); uniquenumbers = unique(numbers); n = length(un...

2 månader ago | 0

| accepted

Submitted

nistdata(species,T,p)

Create tables of thermophysical properties for gases

3 månader ago | 7 downloads |

Answered

Van der Waals equation - Newton's method

In your code, newton_ndim does not know the value of T and so cannot call fun(X,T). You can probably fix this by defining an in...

Van der Waals equation - Newton's method

In your code, newton_ndim does not know the value of T and so cannot call fun(X,T). You can probably fix this by defining an in...

4 månader ago | 0

| accepted

Submitted

Curvature of a 2D or 3D curve

Calculates the local radius of curvature as well as the cumulative arc length and the curvature vector along a 1D curve in 2D or...

4 månader ago | 98 downloads |

Solved

How Far Can You Throw Something?

As you probably learned in your high school physics class, throwing an object at a 45 degree angle will give you the maximum ran...

4 månader ago