Answered

fitting scatter data into multiple cosine functions

Yes, but it is always tricky to fit such sinusoids without good starting estimates. I'm going to use lsqcurvefit from the optimi...

fitting scatter data into multiple cosine functions

Yes, but it is always tricky to fit such sinusoids without good starting estimates. I'm going to use lsqcurvefit from the optimi...

3 days ago | 0

Question

Is the Moving Variance block in Simulink vectorised?

I'm using the Moving Variance block in Simulink and it seems to be giving unexplained results for vectorised (muxed) inputs. My ...

10 days ago | 0 answers | 0

Answered

2D Convolution - Sobel Filter. What is wrong?

Here's my (old) code for a sobel filter: img = imread('Davis_Hall.jpg'); % 'Davis_Hall.jpg':color image X =double(rgb2gray(i...

2D Convolution - Sobel Filter. What is wrong?

Here's my (old) code for a sobel filter: img = imread('Davis_Hall.jpg'); % 'Davis_Hall.jpg':color image X =double(rgb2gray(i...

1 month ago | 0

Answered

Related to Matlab Step Comment

You are possibly confusing the closed loop response with the open loop. The closed loop gain is 1/4, so the error is 1-1/4 = 3/4...

Related to Matlab Step Comment

You are possibly confusing the closed loop response with the open loop. The closed loop gain is 1/4, so the error is 1-1/4 = 3/4...

2 months ago | 1

| accepted

Answered

how to solve matrix differential equation

Here's my attempt: M = [ 97227/21875, 0, 82269/109375, 0, 67311/43750, 0, -97227/218750, 0; ... 0, 97227/21875, 0, 822...

how to solve matrix differential equation

Here's my attempt: M = [ 97227/21875, 0, 82269/109375, 0, 67311/43750, 0, -97227/218750, 0; ... 0, 97227/21875, 0, 822...

2 months ago | 1

Answered

From Fir2 output to transfer function

tr_fun should be a discrete transfer function, (not continuous) say tr_fun=tf(BF,1,1); % Generate a DISCRETE Transfer Function...

From Fir2 output to transfer function

tr_fun should be a discrete transfer function, (not continuous) say tr_fun=tf(BF,1,1); % Generate a DISCRETE Transfer Function...

2 months ago | 0

Answered

How to identify corners of data plotted to estimate data between corners

How about using interp1 with the 'pchip' option? You did speculate the interpolation is overly complex, but then again it is onl...

How to identify corners of data plotted to estimate data between corners

How about using interp1 with the 'pchip' option? You did speculate the interpolation is overly complex, but then again it is onl...

3 months ago | 1

| accepted

Answered

How I can find co ordinates of intersection of two curves ?

Oh, looks like this is a common question: See (from 2016)https://au.mathworks.com/matlabcentral/answers/318475-how-to-find-the-i...

How I can find co ordinates of intersection of two curves ?

Oh, looks like this is a common question: See (from 2016)https://au.mathworks.com/matlabcentral/answers/318475-how-to-find-the-i...

3 months ago | 1

Answered

Iterative Method of solving multiple variables without using the curvefit tool

Here's my attempt at fitting uusing lsqcurvefit from the optimisation toolbox. First I generate some synthetic data to subsequ...

Iterative Method of solving multiple variables without using the curvefit tool

Here's my attempt at fitting uusing lsqcurvefit from the optimisation toolbox. First I generate some synthetic data to subsequ...

3 months ago | 0

Answered

how can i calculate the angle of each gradient and x axis?

You could always differentiate to get the slope and then take the arc-tan. syms x real s = 1/(1 + exp(-2*(x-4))) dsdx = dif...

how can i calculate the angle of each gradient and x axis?

You could always differentiate to get the slope and then take the arc-tan. syms x real s = 1/(1 + exp(-2*(x-4))) dsdx = dif...

3 months ago | 0

Answered

Extracting the daily time series from a text file to a single column

A quick hack is: fname = 'D59.txt' Flow = []; fid=fopen(fname); Yr = 2012; R = []; while 1 tline = fgetl(fi...

Extracting the daily time series from a text file to a single column

A quick hack is: fname = 'D59.txt' Flow = []; fid=fopen(fname); Yr = 2012; R = []; while 1 tline = fgetl(fi...

3 months ago | 0

| accepted

Answered

How to Rearrange data?

Try something like the following: First read in the data file (which I've called numData.txt). I've used your test data above. ...

How to Rearrange data?

Try something like the following: First read in the data file (which I've called numData.txt). I've used your test data above. ...

4 months ago | 0

| accepted

Answered

(Food for Thought) Peak Detection on ECG signal

OK, here's my (ugly) solution (withou using findpeaks). I've re-named your data set, and did some pre-processig. load ecg y =...

(Food for Thought) Peak Detection on ECG signal

OK, here's my (ugly) solution (withou using findpeaks). I've re-named your data set, and did some pre-processig. load ecg y =...

4 months ago | 0

| accepted

Answered

Simulating a FIR filter

Use the filter command. In this case your denominator, (A), coefficients are just 1. x = [ 0 0 0 1 1 1 1 1 ]' % input b = [...

Simulating a FIR filter

Use the filter command. In this case your denominator, (A), coefficients are just 1. x = [ 0 0 0 1 1 1 1 1 ]' % input b = [...

4 months ago | 1

| accepted

Answered

Obtain input knowing output and transfer function

Since you have a simple transfer function, here's what I would do. (1) First generate some data that we will subsequently try ...

Obtain input knowing output and transfer function

Since you have a simple transfer function, here's what I would do. (1) First generate some data that we will subsequently try ...

4 months ago | 0

Answered

curve fitting of non linear data for strain-time of creep experiment

Here's my attempt: load data1 t = time; e = strain; plot(t,e) %% Now try curve fit creep = @(p, t) p(1)*(1-exp(-p...

curve fitting of non linear data for strain-time of creep experiment

Here's my attempt: load data1 t = time; e = strain; plot(t,e) %% Now try curve fit creep = @(p, t) p(1)*(1-exp(-p...

5 months ago | 0

| accepted

Answered

Trouble with time delay differential equation

I've only made one small change to your function. You have tried to index a non-integer number back, but the "Z" variable holds ...

Trouble with time delay differential equation

I've only made one small change to your function. You have tried to index a non-integer number back, but the "Z" variable holds ...

5 months ago | 0

Answered

How can I simultaneously solve for these equations?

If you have the symbolic toolbox, a straight forward approach works, although it takes some time ... % ODE propblem syms B...

How can I simultaneously solve for these equations?

If you have the symbolic toolbox, a straight forward approach works, although it takes some time ... % ODE propblem syms B...

5 months ago | 0

Answered

Error when using ode15

It is good practice to try and avoid globals, but rather pass them as auxilary variables into the function. Fao = 1487.351; % ...

Error when using ode15

It is good practice to try and avoid globals, but rather pass them as auxilary variables into the function. Fao = 1487.351; % ...

5 months ago | 0

| accepted

Answered

Plotting Step Response of a Differential Equation

You are close to a viable solution. Solve for an analytical solution, then make it a Matlab (anonymous) function with matlabFunc...

Plotting Step Response of a Differential Equation

You are close to a viable solution. Solve for an analytical solution, then make it a Matlab (anonymous) function with matlabFunc...

5 months ago | 0

Answered

Runge-Kutta 4th order method

First up, you will need a much smaller step size to get an accurate solution using this explicit RK4 (with no error control). I ...

Runge-Kutta 4th order method

First up, you will need a much smaller step size to get an accurate solution using this explicit RK4 (with no error control). I ...

6 months ago | 0

| accepted

Answered

How to draw Fig. 1 from the attached pdf with this code

I didn't bother draw the other 3 lines, but you just ned to make the necessary changes to gamma for that. If you run somethi...

How to draw Fig. 1 from the attached pdf with this code

I didn't bother draw the other 3 lines, but you just ned to make the necessary changes to gamma for that. If you run somethi...

6 months ago | 0

| accepted

Answered

fsurf not drawing cant explain

Do you really need to use the symbolic toolbox? Why not just plot a numerical surface? But you are right, your numbers are widel...

fsurf not drawing cant explain

Do you really need to use the symbolic toolbox? Why not just plot a numerical surface? But you are right, your numbers are widel...

6 months ago | 0

Answered

Fitting Monod Equation with ODE45 to data using lsqcurvefit function

Here's my solution. First set up the measured data, plot it, and look to see that it is all OK. t = [0 3 5 8 9.5 11.5 14 16 ...

Fitting Monod Equation with ODE45 to data using lsqcurvefit function

Here's my solution. First set up the measured data, plot it, and look to see that it is all OK. t = [0 3 5 8 9.5 11.5 14 16 ...

6 months ago | 0

| accepted

Answered

Solve integrals with Matlab

Do you have the symbolic toolbox? If so, start with the int command. You can do both indefinite and definite integration. sy...

Solve integrals with Matlab

Do you have the symbolic toolbox? If so, start with the int command. You can do both indefinite and definite integration. sy...

6 months ago | 1

| accepted

Answered

MATLAB Help - Rolling Dice Simulation / Central Limit Theorem

A quick hack using randi and cumsum is N = 100 x = randi(6,N,6); cs = cumsum(x')'; for i=1:6 subplot(3,2,i) histogram...

MATLAB Help - Rolling Dice Simulation / Central Limit Theorem

A quick hack using randi and cumsum is N = 100 x = randi(6,N,6); cs = cumsum(x')'; for i=1:6 subplot(3,2,i) histogram...

6 months ago | 0

| accepted

Answered

How to calculate the accumulated rainfall value of 1, 2, 3, 4, 5, 6 and 7 days.

Here is my solution: I notice that you've got few NaNs for about a year and a half. Your last year is also incomplete. I is...

How to calculate the accumulated rainfall value of 1, 2, 3, 4, 5, 6 and 7 days.

Here is my solution: I notice that you've got few NaNs for about a year and a half. Your last year is also incomplete. I is...

6 months ago | 0

| accepted

Answered

plot x axis as persentage

Below, I've plotted an arbitrary function between arbitrary limits, -5 and +37. %% x = linspace(-5,37)'; y = erf(x/20); ...

plot x axis as persentage

Below, I've plotted an arbitrary function between arbitrary limits, -5 and +37. %% x = linspace(-5,37)'; y = erf(x/20); ...

6 months ago | 0

Answered

inline function error help(tanh)

I can, but perhaps you should use anonymous functions. The inline approach is now discouraged. Instead of what you wrote above...

inline function error help(tanh)

I can, but perhaps you should use anonymous functions. The inline approach is now discouraged. Instead of what you wrote above...

6 months ago | 0

Answered

how to plot multiple waves on one surface

Here is a mock up solution. Code is: below. I've used part of your data, but I've made up some similar data (using a sinc fun...

how to plot multiple waves on one surface

Here is a mock up solution. Code is: below. I've used part of your data, but I've made up some similar data (using a sinc fun...

6 months ago | 0