Networker, learner, educator

Professional Interests: Spacecraft dynamics and control, numerical analysis, simulation, animation

Answered

How to count the number of different strings in a string list?

Hi, use str = {'AAA','ABB','CDE','ABB','CCR','AAA','FDR'}; numstr = numel(unique(str))

How to count the number of different strings in a string list?

Hi, use str = {'AAA','ABB','CDE','ABB','CCR','AAA','FDR'}; numstr = numel(unique(str))

ungefär 12 timmar ago | 0

| accepted

Answered

How to extract value at a given time in ode 45

Hi Shubham, use an events functions, see the example below. With events functions you can identify zero crossings; in your case ...

How to extract value at a given time in ode 45

Hi Shubham, use an events functions, see the example below. With events functions you can identify zero crossings; in your case ...

ungefär 17 timmar ago | 0

| accepted

Answered

Draw a circle on matlab app designer?

Hi ErikJon, if the plot input is a matrix (e.g. your circ) "...the plot function plots the columns of the matrix (circ) versus t...

Draw a circle on matlab app designer?

Hi ErikJon, if the plot input is a matrix (e.g. your circ) "...the plot function plots the columns of the matrix (circ) versus t...

en dag ago | 0

| accepted

Answered

please help me (dsolve)

Use instead syms y(t) eqn = diff(y,t,2) + 0.5*diff(y,t) + y == 3; Dy = diff(y,t); cond = [y(0) == 0.5, Dy(0) == 0]; w ...

please help me (dsolve)

Use instead syms y(t) eqn = diff(y,t,2) + 0.5*diff(y,t) + y == 3; Dy = diff(y,t); cond = [y(0) == 0.5, Dy(0) == 0]; w ...

2 dagar ago | 0

Answered

confusing ode suits for solving discontinuous odes

Hi, this is because the integrator, ode45, adjusts the integration step size. Broadly speaking where the dynamics is more comple...

confusing ode suits for solving discontinuous odes

Hi, this is because the integrator, ode45, adjusts the integration step size. Broadly speaking where the dynamics is more comple...

3 dagar ago | 0

| accepted

Answered

How to Find average value for every 10 sets of a matrix

Hi Magdy, you could use something like: x = 1:1:12; % this would be your matrix A y = reshape(x,3,4) m = mean(y,1)

How to Find average value for every 10 sets of a matrix

Hi Magdy, you could use something like: x = 1:1:12; % this would be your matrix A y = reshape(x,3,4) m = mean(y,1)

3 dagar ago | 0

| accepted

Answered

How to Use "Ask a Question" Section Correctly?

Hi Ercan, thanks for flagging this. I have seen the same behavior this morning in Chrome, other browsers seemed to work fine. I ...

How to Use "Ask a Question" Section Correctly?

Hi Ercan, thanks for flagging this. I have seen the same behavior this morning in Chrome, other browsers seemed to work fine. I ...

5 dagar ago | 3

| accepted

Answered

ODE Event Location detecting events other than zero

Hi Hariharan, yes it is. You simply define a function that is equal to zero whenever your expression equals a certain value. Fo...

ODE Event Location detecting events other than zero

Hi Hariharan, yes it is. You simply define a function that is equal to zero whenever your expression equals a certain value. Fo...

5 dagar ago | 0

| accepted

Answered

How do I change the values for x-axis ?

Hi Anne-Lise, do you mean changing the tick labels? See this answer. If this does not address your question, how exactly do you ...

How do I change the values for x-axis ?

Hi Anne-Lise, do you mean changing the tick labels? See this answer. If this does not address your question, how exactly do you ...

5 dagar ago | 0

Answered

Why is the resulting time-domain curve from Euler method and ode45 not stable?

Hi Ni Made Ayu Sinta Dewi, there is nothing you are doing wrong. What you are seeing is expected behavior. This is because you a...

Why is the resulting time-domain curve from Euler method and ode45 not stable?

Hi Ni Made Ayu Sinta Dewi, there is nothing you are doing wrong. What you are seeing is expected behavior. This is because you a...

5 dagar ago | 0

| accepted

Answered

ode45 fail with pendulum

Hi Bobby, this is the wonderful world of numerical (vs symbolic) computation. ode45 is a numerical integrator that approximates ...

ode45 fail with pendulum

Hi Bobby, this is the wonderful world of numerical (vs symbolic) computation. ode45 is a numerical integrator that approximates ...

5 dagar ago | 0

| accepted

Answered

Changing Length of Pendulum while it is in motion

Dear Yan Koon Ang, this is possible. In the example you are referring to in your question you would have to make the time varia...

Changing Length of Pendulum while it is in motion

Dear Yan Koon Ang, this is possible. In the example you are referring to in your question you would have to make the time varia...

7 dagar ago | 1

Answered

I am trying to plot x and y with y being the only unknown but I don’t what is wrong in my code please help

Honore, the one thing I notice is that x and y are vectors. Rewrite the y-equation using the dot operator, .^ instead of just ...

I am trying to plot x and y with y being the only unknown but I don’t what is wrong in my code please help

Honore, the one thing I notice is that x and y are vectors. Rewrite the y-equation using the dot operator, .^ instead of just ...

8 dagar ago | 0

| accepted

Answered

Finding the initial conditions which give a specified event using ode45

Patrick, as Walter pointed out this is a BVP. However, you can and I personally would use ode45 and the so-called shooting meth...

Finding the initial conditions which give a specified event using ode45

Patrick, as Walter pointed out this is a BVP. However, you can and I personally would use ode45 and the so-called shooting meth...

8 dagar ago | 0

Answered

Differential equation by simulink

Double-klick on the integrator blocks and you'll see that the default initial condition is zero (0). It is also inside the integ...

Differential equation by simulink

Double-klick on the integrator blocks and you'll see that the default initial condition is zero (0). It is also inside the integ...

8 dagar ago | 0

Answered

when i run the code the plot graphs appears empty here is the code please help to find the mistake i made

Seif, I believe this is what you are trying to do: %calculating velocity V3 = 10; % velocity of the piston in cm/sec %global...

when i run the code the plot graphs appears empty here is the code please help to find the mistake i made

Seif, I believe this is what you are trying to do: %calculating velocity V3 = 10; % velocity of the piston in cm/sec %global...

9 dagar ago | 0

| accepted

Answered

How to change a Function by a Variable

Ercan, here you go, for the first term: syms phi x A B eq = A*sin(phi) + B*cos(phi) eq = subs(eq,sin(phi),2*x/(1+x^2))

How to change a Function by a Variable

Ercan, here you go, for the first term: syms phi x A B eq = A*sin(phi) + B*cos(phi) eq = subs(eq,sin(phi),2*x/(1+x^2))

9 dagar ago | 1

| accepted

Answered

How to write Newton method with exact number of iterations and see all digit ? for example if method is required to take exact 5 iterations of newton's method

Add a loop index, e.g. ii. Also, you set your code as a function. This means you can call it, e.g., from the command window usin...

How to write Newton method with exact number of iterations and see all digit ? for example if method is required to take exact 5 iterations of newton's method

Add a loop index, e.g. ii. Also, you set your code as a function. This means you can call it, e.g., from the command window usin...

9 dagar ago | 0

Answered

serie with two parameters

Sara, it really depends on what you are trying to achieve. For starters you could use two for loops to take care of the summatio...

serie with two parameters

Sara, it really depends on what you are trying to achieve. For starters you could use two for loops to take care of the summatio...

10 dagar ago | 0

Answered

Plotting a function with 2 dependent variables

Use meshgrid instead: [x,y] = meshgrid(-10:0.1:10); z = sin(x).*cos(y); plot3(x,y,z)

Plotting a function with 2 dependent variables

Use meshgrid instead: [x,y] = meshgrid(-10:0.1:10); z = sin(x).*cos(y); plot3(x,y,z)

11 dagar ago | 0

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

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

13 dagar ago | 0

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

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

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

13 dagar 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')) ...

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

14 dagar 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)

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

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

15 dagar ago | 1

| accepted