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 = [...

3 years 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 ...

3 years ago | 2

| accepted

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...

3 years 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 ...

3 years 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...

3 years 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; % ...

3 years 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...

3 years 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 ...

3 years 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...

3 years 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...

3 years 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 ...

3 years 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...

3 years 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...

3 years 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...

3 years 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); ...

3 years 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...

3 years 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...

3 years ago | 0

Answered

LaTex with 2 strings separated by a num2str

Use an escape (backslash) for the % errordisplay=[' $\varepsilon_{RTP}=$ ',num2str(rtep),'\%'];

LaTex with 2 strings separated by a num2str

Use an escape (backslash) for the % errordisplay=[' $\varepsilon_{RTP}=$ ',num2str(rtep),'\%'];

3 years ago | 1

Answered

Solving second order implicit differential equation

Just convert the 2nd order ODE into Cauchy form. You will of course need 2 initial condtions. Define x, now you original equat...

Solving second order implicit differential equation

Just convert the 2nd order ODE into Cauchy form. You will of course need 2 initial condtions. Define x, now you original equat...

3 years ago | 0

| accepted

Answered

Stimulating Chemical Reaction with Differential Equation on Simulink

Homework? Anyway, to get you started, take a look at my Simulink layout: I've painted the integrators yellow, and I have expli...

Stimulating Chemical Reaction with Differential Equation on Simulink

Homework? Anyway, to get you started, take a look at my Simulink layout: I've painted the integrators yellow, and I have expli...

3 years ago | 0

Answered

how do i rotate an airfoil points? and plot.

Does this look better? Some (small) changes to your code. I swapped your rotation direction to better follow your example pl...

how do i rotate an airfoil points? and plot.

Does this look better? Some (small) changes to your code. I swapped your rotation direction to better follow your example pl...

3 years ago | 3

| accepted

Answered

plotting an exponential will a matrix over time

OK, your question is a bit vauge, and there are missing bits, i.e. the start point for y. I'm assuming you are trying to solve...

plotting an exponential will a matrix over time

OK, your question is a bit vauge, and there are missing bits, i.e. the start point for y. I'm assuming you are trying to solve...

3 years ago | 0

Answered

finding lengths of an ellipse

If you need a little more help, then it pays to plot the ellipse and look at the arc lengths. t = linspace(0,2*pi)'; x = @(t)...

finding lengths of an ellipse

If you need a little more help, then it pays to plot the ellipse and look at the arc lengths. t = linspace(0,2*pi)'; x = @(t)...

3 years ago | 0

| accepted

Answered

I want to know how i can apply k-means clustering on my scatter plotted dataset.

You probably want to use kmeans. Since you didn't give us any data to workj with, nor did you give us any idea of the number o...

I want to know how i can apply k-means clustering on my scatter plotted dataset.

You probably want to use kmeans. Since you didn't give us any data to workj with, nor did you give us any idea of the number o...

3 years ago | 1

| accepted

Answered

Fitting model to titration data

For one thing, you don't assign an answer to function sseval. That's not going to help things. Here's my solution: I've re...

Fitting model to titration data

For one thing, you don't assign an answer to function sseval. That's not going to help things. Here's my solution: I've re...

3 years ago | 2

Answered

Position of two subplots with bar charts

One option is to obtain the position of the plot with the long legend, and then re-size the other to the same width. But it's pr...

Position of two subplots with bar charts

One option is to obtain the position of the plot with the long legend, and then re-size the other to the same width. But it's pr...

3 years ago | 1

Answered

Histogram x axis tick labels – string

Try >> get(gca,'XTicklabel') and hack that.

Histogram x axis tick labels – string

Try >> get(gca,'XTicklabel') and hack that.

3 years ago | 1

| accepted

Answered

Histogram x axis tick labels – string

Released 2016b. What's your version? >> which xticklabels C:\Program Files\MATLAB\R2018b\toolbox\matlab\graph3d\xticklabels.m...

Histogram x axis tick labels – string

Released 2016b. What's your version? >> which xticklabels C:\Program Files\MATLAB\R2018b\toolbox\matlab\graph3d\xticklabels.m...

3 years ago | 0

Answered

Histogram x axis tick labels – string

Hack the final xticklabel x = randn(1e5,1); x= x-min(x)+1; histogram(log(x)) xlim([0,3]) xt = xticklabels; xt{end} = 'oth...

Histogram x axis tick labels – string

Hack the final xticklabel x = randn(1e5,1); x= x-min(x)+1; histogram(log(x)) xlim([0,3]) xt = xticklabels; xt{end} = 'oth...

3 years ago | 1

Answered

solving a very complicated equation implicitly

A quick answer is you probably need to dot-divide (./) the term with the (vector) rpf. 2nd point. Because I used a root finder...

solving a very complicated equation implicitly

A quick answer is you probably need to dot-divide (./) the term with the (vector) rpf. 2nd point. Because I used a root finder...

3 years ago | 0