Answered

How to plot streamlines continuously?

Not entirely sure what you mean. Changing startx and starty values? In your code you set the starting values on the y-axis to 0....

How to plot streamlines continuously?

Not entirely sure what you mean. Changing startx and starty values? In your code you set the starting values on the y-axis to 0....

1 year ago | 1

| accepted

Answered

ode45 solver SIR model

Hi Ollie, to get the area under the curve, just add another integration variable that integrates over the curve, y(2), I called...

ode45 solver SIR model

Hi Ollie, to get the area under the curve, just add another integration variable that integrates over the curve, y(2), I called...

1 year ago | 1

| accepted

Answered

Extracting specific parts of an array

Assuming your variable is called data_velocity use something like: extractdata = data_velocity(data_velocity<0.1 & data_velocit...

Extracting specific parts of an array

Assuming your variable is called data_velocity use something like: extractdata = data_velocity(data_velocity<0.1 & data_velocit...

1 year ago | 0

Answered

Simple For cycle (a small problem with the indexes)

There you go: omega_vet(1) = 55000; for i=1:length(phi_10(init:end)) x_ER_vet(i) = interp1(mass_flow_turbine_cor...

Simple For cycle (a small problem with the indexes)

There you go: omega_vet(1) = 55000; for i=1:length(phi_10(init:end)) x_ER_vet(i) = interp1(mass_flow_turbine_cor...

1 year ago | 1

| accepted

Answered

How can I get the first zero maximum in my program?

Georges, you could use something like this to find your first zero: b(find((abs(a)<1e-12),1)) Of course, this is assuming, for...

How can I get the first zero maximum in my program?

Georges, you could use something like this to find your first zero: b(find((abs(a)<1e-12),1)) Of course, this is assuming, for...

1 year ago | 0

| accepted

Answered

Displaying actual values from coded values for a for loop.

Wiktor, simply replace the is_leap_year(i) command with an if statement. Quick and dirty: if (strcmp(is_leap_year(i),'True')) ...

Displaying actual values from coded values for a for loop.

Wiktor, simply replace the is_leap_year(i) command with an if statement. Quick and dirty: if (strcmp(is_leap_year(i),'True')) ...

1 year ago | 0

| accepted

Answered

question about fplot function

Hi Kris, syms y(x) Dy = diff(y,x,1); DDy = diff(y,x,2); ysol = dsolve(DDy + 3*Dy == 12*x - 5, y(0) == 1,Dy(0) == 0) fplo...

question about fplot function

Hi Kris, syms y(x) Dy = diff(y,x,1); DDy = diff(y,x,2); ysol = dsolve(DDy + 3*Dy == 12*x - 5, y(0) == 1,Dy(0) == 0) fplo...

1 year ago | 0

Answered

Sorting array by datetimes does not work

Convert to and sort the table: T = sortrows(cell2table(HR_date_time_strings),2)

Sorting array by datetimes does not work

Convert to and sort the table: T = sortrows(cell2table(HR_date_time_strings),2)

1 year ago | 0

Answered

Turning my function into an infinite loop

Hi Faris, instead of a for loop use a while loop with a condition like while abs(s_k - s_k1) > TolMax % here comes your co...

Turning my function into an infinite loop

Hi Faris, instead of a for loop use a while loop with a condition like while abs(s_k - s_k1) > TolMax % here comes your co...

1 year ago | 0

| accepted

Answered

How long do I have access to Matlab on a Academic license?

Matthew, your academic license is good for one year starting from the date the license has been purchased. Contact me directly a...

How long do I have access to Matlab on a Academic license?

Matthew, your academic license is good for one year starting from the date the license has been purchased. Contact me directly a...

1 year ago | 1

| accepted

Answered

How do I change axes scale in a surface plot by a predefined factor?

Iron, if it just about changing the labels simply use xticklabels(). See the example below: x = linspace(-10,10,200); y = cos(...

How do I change axes scale in a surface plot by a predefined factor?

Iron, if it just about changing the labels simply use xticklabels(). See the example below: x = linspace(-10,10,200); y = cos(...

1 year ago | 0

Answered

Error when opening a new figure

Hi Ran, in the error message it says that 'figue' is not recognized. There may be an 'r' missing (to make it 'figure'). If this ...

Error when opening a new figure

Hi Ran, in the error message it says that 'figue' is not recognized. There may be an 'r' missing (to make it 'figure'). If this ...

1 year ago | 0

Answered

How to use unique in a conditional statement nested in for loop?

Usman, you could do it this way. First compute all solutions in a matrix X and then compute unique values. n = 1000; for a = 1...

How to use unique in a conditional statement nested in for loop?

Usman, you could do it this way. First compute all solutions in a matrix X and then compute unique values. n = 1000; for a = 1...

1 year ago | 0

| accepted

Answered

Failure in initial objective function evaluation. FSOLVE cannot continue.

Ahmed, use the following: fhandle = @Sample13; options = optimset('display','off','Algorithm','levenberg-marquardt'); a ...

Failure in initial objective function evaluation. FSOLVE cannot continue.

Ahmed, use the following: fhandle = @Sample13; options = optimset('display','off','Algorithm','levenberg-marquardt'); a ...

1 year ago | 0

| accepted

Answered

Hourly and 6-hourly average of data in timeable

Phoebe, it looks like your data points are all equally spaced(?), 10 minutes. Check out the movmean() command.

Hourly and 6-hourly average of data in timeable

Phoebe, it looks like your data points are all equally spaced(?), 10 minutes. Check out the movmean() command.

1 year ago | 0

Answered

How to arrange correctly with a graph

Anton, add t as an input arg to: function y_out=rhs(t,y)

How to arrange correctly with a graph

Anton, add t as an input arg to: function y_out=rhs(t,y)

1 year ago | 1

| accepted

Answered

(FOR STEP RESPONSE GRAPHICS) how to make an inset of matlab figure inside the figure

Hi Dorukhan, add another axes() to the bottom of your code. E.g. p = get(gca, 'Position'); h = axes('Parent', gcf, 'Position'...

(FOR STEP RESPONSE GRAPHICS) how to make an inset of matlab figure inside the figure

Hi Dorukhan, add another axes() to the bottom of your code. E.g. p = get(gca, 'Position'); h = axes('Parent', gcf, 'Position'...

1 year ago | 0

Answered

Error in my ode45 equation.

Hi Zara, your vector of initial conditions has 5 components yo = [4 0 0 1 500.15]; however, you only have 4 differential equa...

Error in my ode45 equation.

Hi Zara, your vector of initial conditions has 5 components yo = [4 0 0 1 500.15]; however, you only have 4 differential equa...

1 year ago | 0

Answered

Error - matrix dimensions must agree

Hi Joe, I think this is what you are trying to do: x0 = 2; y0 = 2; x = [x0; y0]; iter = 0; max_iter = 100; tol = 0.001; ...

Error - matrix dimensions must agree

Hi Joe, I think this is what you are trying to do: x0 = 2; y0 = 2; x = [x0; y0]; iter = 0; max_iter = 100; tol = 0.001; ...

1 year ago | 0

Answered

Grid a plot with diagonal lines

There are a couple of things you could do. E.g. x = -5:1:5; N = numel(x); X = ones(N,1)*x; Y = X + X'; plot(X',Y'); grid

Grid a plot with diagonal lines

There are a couple of things you could do. E.g. x = -5:1:5; N = numel(x); X = ones(N,1)*x; Y = X + X'; plot(X',Y'); grid

1 year ago | 0

| accepted

Answered

how to calculate the index of minimum value in each column cell array

Mohammad, use cell2mat() to convert the cell array to an ordinary array (e.g. A) and then use [val,loc] = min(A,[],1)

how to calculate the index of minimum value in each column cell array

Mohammad, use cell2mat() to convert the cell array to an ordinary array (e.g. A) and then use [val,loc] = min(A,[],1)

1 year ago | 1

| accepted

Answered

Graph can not show correct point

Hi Carey, ode45() picks its own time steps to do the integration. However, you can prescribe the times at which you want integra...

Graph can not show correct point

Hi Carey, ode45() picks its own time steps to do the integration. However, you can prescribe the times at which you want integra...

1 year ago | 0

Answered

how to plot to some maximum axis level?

Add axis([0 70 -inf inf])

how to plot to some maximum axis level?

Add axis([0 70 -inf inf])

1 year ago | 1

| accepted

Answered

Problem with plotting equation

Hi George, use fimplicit(): syms x y f(x,y) = log(y/x)-(sigma_e/sigma_a)*(log(1+x*sigma_a*tau*lambda_0/(h*c))-log(1+(x*sigma_a...

Problem with plotting equation

Hi George, use fimplicit(): syms x y f(x,y) = log(y/x)-(sigma_e/sigma_a)*(log(1+x*sigma_a*tau*lambda_0/(h*c))-log(1+(x*sigma_a...

1 year ago | 0

| accepted

Answered

Error using symfun>validateArgNames (line 333) Second argument must be a scalar or vector of unique symbolic variables.

Hi Ahmed, almost there: syms x y y = symfun(x + exp(x),x); figure(1) fplot(y,[-13,13]) grid on In your code you declare x ...

Error using symfun>validateArgNames (line 333) Second argument must be a scalar or vector of unique symbolic variables.

Hi Ahmed, almost there: syms x y y = symfun(x + exp(x),x); figure(1) fplot(y,[-13,13]) grid on In your code you declare x ...

1 year ago | 0

| accepted

Answered

how to get higher order derivative in ODE function

Hi Giacomo, when you solve the ODE this means you have solutions for y(t) and y'(t). You can then simply use the same equation f...

how to get higher order derivative in ODE function

Hi Giacomo, when you solve the ODE this means you have solutions for y(t) and y'(t). You can then simply use the same equation f...

1 year ago | 0

Answered

How to solve "index exceeds the number of array elements"

Hi Ryan, try something like this: fl = 100; fu = 1500; % replace as necessary N = 100; f = linspace(fl,fu,N); cm = 0; f...

How to solve "index exceeds the number of array elements"

Hi Ryan, try something like this: fl = 100; fu = 1500; % replace as necessary N = 100; f = linspace(fl,fu,N); cm = 0; f...

1 year ago | 1

| accepted

Answered

Fixing code to plot an ODE

Hi, you are almost there. This should get you started: hold on for n=1:200 p=.01*n; alpha=[.1; .5; .3]; beta=[....

Fixing code to plot an ODE

Hi, you are almost there. This should get you started: hold on for n=1:200 p=.01*n; alpha=[.1; .5; .3]; beta=[....

1 year ago | 1

| accepted

Answered

Change value of variable in while loop

Hi Anon, based on your problem description and assuming you are simulating the motion of one projectile in 3D I suggest you use...

Change value of variable in while loop

Hi Anon, based on your problem description and assuming you are simulating the motion of one projectile in 3D I suggest you use...

1 year ago | 0

Answered

using ode45 to solve 3 ODEs with solar radiation

Hi Hasan, based on the error message I suggest looking into tdot at the bottom of your ode function. Apparently, this is a 17x1...

using ode45 to solve 3 ODEs with solar radiation

Hi Hasan, based on the error message I suggest looking into tdot at the bottom of your ode function. Apparently, this is a 17x1...

1 year ago | 1