Answered

Mark the knee point on a graph

Calculate a vector of values of P = V.*I then choose the maximum. Something like: P = V.*I; indx = find(P==max(P)); Vp = V(in...

Mark the knee point on a graph

Calculate a vector of values of P = V.*I then choose the maximum. Something like: P = V.*I; indx = find(P==max(P)); Vp = V(in...

environ 5 heures ago | 0

| accepted

Answered

Discretising a size distribution function and area under the curve

You should have log(sigma)^2, not log(sigma^2). Don't forget the "dx" part when integrating the curve. mu = 0.015; % geometri...

Discretising a size distribution function and area under the curve

You should have log(sigma)^2, not log(sigma^2). Don't forget the "dx" part when integrating the curve. mu = 0.015; % geometri...

environ 6 heures ago | 1

Answered

ODE system initial condition results in infinity/NaN error. Initial conditions cannot be changed. How to evade?

Simply write your differential function as: fu_p = @(D_p,u_p) -18*muG*u_p/(rhoP*D_p^2) + g*(rhoP-rhoG)/rhoP; avoiding any expl...

ODE system initial condition results in infinity/NaN error. Initial conditions cannot be changed. How to evade?

Simply write your differential function as: fu_p = @(D_p,u_p) -18*muG*u_p/(rhoP*D_p^2) + g*(rhoP-rhoG)/rhoP; avoiding any expl...

1 jour ago | 0

| accepted

Answered

Single bubble expansion equation

Try starting your bubble radius as 2*sigma/1.4, rather than 0.

Single bubble expansion equation

Try starting your bubble radius as 2*sigma/1.4, rather than 0.

2 jours ago | 0

| accepted

Answered

Coupled rate ODEs with ode45

It can all be done in one script as follows. Because of the orders of magntude difference between the various concentrations th...

Coupled rate ODEs with ode45

It can all be done in one script as follows. Because of the orders of magntude difference between the various concentrations th...

2 jours ago | 0

Answered

How can I call the highest order solution (e.g. x'') of an ode in another ode?

You can rearrange the equations as follows to get a consistent set: (you will need to use explicit multiplication where my eq...

How can I call the highest order solution (e.g. x'') of an ode in another ode?

You can rearrange the equations as follows to get a consistent set: (you will need to use explicit multiplication where my eq...

2 jours ago | 0

| accepted

Answered

How can I make a loop that gives values in each iteration?

Why do you need a loop? There is just one zero between 2 and 8. Your values of w are not used in any meaningful way (they woul...

How can I make a loop that gives values in each iteration?

Why do you need a loop? There is just one zero between 2 and 8. Your values of w are not used in any meaningful way (they woul...

3 jours ago | 0

Answered

How to use ODE 45 to generate a SIR model

Like so: alpha=1.99; beta=1; gamma=1/7; S=0.99; I=0.01; R=0.1; %tstart=0; %tend=100; y=[S,I,R]; tspan=0:1:100; [t,sol...

How to use ODE 45 to generate a SIR model

Like so: alpha=1.99; beta=1; gamma=1/7; S=0.99; I=0.01; R=0.1; %tstart=0; %tend=100; y=[S,I,R]; tspan=0:1:100; [t,sol...

3 jours ago | 2

Answered

error in using the function fsolve to find steady state

Using the Optimization toolbox to solve these equations seems like using a sledgehammer to crack a nut! It is clear from the eq...

error in using the function fsolve to find steady state

Using the Optimization toolbox to solve these equations seems like using a sledgehammer to crack a nut! It is clear from the eq...

3 jours ago | 0

Answered

I am trying to solve ODE having more than 1 dependent variable. but I am not able to solve it with dsolve function. please help me to find correct function to solve ODE.This is an mechanical engineering equation so it is bit complicated and lengthy

Here's a possible way using ode45. I've used arbitrary initial values for the three temperatures, so you will need to replace t...

I am trying to solve ODE having more than 1 dependent variable. but I am not able to solve it with dsolve function. please help me to find correct function to solve ODE.This is an mechanical engineering equation so it is bit complicated and lengthy

Here's a possible way using ode45. I've used arbitrary initial values for the three temperatures, so you will need to replace t...

3 jours ago | 1

| accepted

Answered

MATLAB Newton Raphson Method with a function with array/matrix variables

You could do it like this f = @(x,g) g.*exp(x) - 1; df = @(x,g) g.*exp(x); g = [1 2 3 4 5]; for i= 1:numel(g) x0 = 0...

MATLAB Newton Raphson Method with a function with array/matrix variables

You could do it like this f = @(x,g) g.*exp(x) - 1; df = @(x,g) g.*exp(x); g = [1 2 3 4 5]; for i= 1:numel(g) x0 = 0...

3 jours ago | 1

| accepted

Answered

When i try to create function error "Unable to perform assignment because the left and right sides have a different number of elements." comes up

Try n=-25:25; x3=zeros(1,length(n)); x3(n>=2 & n<=22)=exp(j*(0.5)).^(2:22);

When i try to create function error "Unable to perform assignment because the left and right sides have a different number of elements." comes up

Try n=-25:25; x3=zeros(1,length(n)); x3(n>=2 & n<=22)=exp(j*(0.5)).^(2:22);

4 jours ago | 0

| accepted

Answered

Explicit Eulers Method for time advancement

T(i)^(n+1) This will raise T(i) to the (n+1)th power! You need another loop for time (say j = 1:something), then you can refer...

Explicit Eulers Method for time advancement

T(i)^(n+1) This will raise T(i) to the (n+1)th power! You need another loop for time (say j = 1:something), then you can refer...

4 jours ago | 0

Answered

Hot to fit two curves under interdependent constraint ?

How about just using fminsearch x = linspace(1,100,100); % Measurement results: y1=[0.07469056,0.07378624,0.07288704,0.071992...

Hot to fit two curves under interdependent constraint ?

How about just using fminsearch x = linspace(1,100,100); % Measurement results: y1=[0.07469056,0.07378624,0.07288704,0.071992...

4 jours ago | 0

| accepted

Answered

Need assistance using bisection method to find equation roots in Matlab function.

Try this % input for function that we're finding the roots of f1 = @(x) ((-0.6)*x^2)+(2.4*x)+(5.5); xl = 5; % xl sets the i...

Need assistance using bisection method to find equation roots in Matlab function.

Try this % input for function that we're finding the roots of f1 = @(x) ((-0.6)*x^2)+(2.4*x)+(5.5); xl = 5; % xl sets the i...

4 jours ago | 0

| accepted

Answered

Errors in Newton Raphson Code

Again, more like this % f = 3*exp(x)-4*cos(x) % df/dx = 3*exp(x)+4*sin(x) i=1; x=0.1; err = 1; while err>10^-8 && i<100 ...

Errors in Newton Raphson Code

Again, more like this % f = 3*exp(x)-4*cos(x) % df/dx = 3*exp(x)+4*sin(x) i=1; x=0.1; err = 1; while err>10^-8 && i<100 ...

4 jours ago | 0

Answered

Error in Newton-Raphson Method

Like this R=15/2; v=500; h=8; i=1; err = 1; while err>10^-8 && i<100 hold = h; fh = pi*h^2*(3*R - h)/3 - v; ...

Error in Newton-Raphson Method

Like this R=15/2; v=500; h=8; i=1; err = 1; while err>10^-8 && i<100 hold = h; fh = pi*h^2*(3*R - h)/3 - v; ...

4 jours ago | 0

Answered

Plotting partial sums of series

Do you mean something like this? x = -pi:0.1:pi ; %initializing x S = zeros(20,numel(x)); figure xlim([1 20]) grid hold o...

Plotting partial sums of series

Do you mean something like this? x = -pi:0.1:pi ; %initializing x S = zeros(20,numel(x)); figure xlim([1 20]) grid hold o...

5 jours ago | 0

| accepted

Answered

Anonymous function surface plot

Are you looking for something like this? n = 2; x_opt = randi([-6,6],n,1); A = randi(n,n); T = A*A' + eye(n,n); h = -T*x_op...

Anonymous function surface plot

Are you looking for something like this? n = 2; x_opt = randi([-6,6],n,1); A = randi(n,n); T = A*A' + eye(n,n); h = -T*x_op...

5 jours ago | 1

| accepted

Answered

Solving system of ODEs and Plotting

Something like this? timerange= [0 60]; [t, hvl] = ode45(@f, timerange, [0.9,0.1,0.2]); plot(t, hvl, 'LineWidth', 2),grid ...

Solving system of ODEs and Plotting

Something like this? timerange= [0 60]; [t, hvl] = ode45(@f, timerange, [0.9,0.1,0.2]); plot(t, hvl, 'LineWidth', 2),grid ...

6 jours ago | 0

| accepted

Answered

Plot 3D of a function

Are you looking for something like this? x = linspace(0,pi); t = linspace(0,1); z = @(x,t) 10*exp(-4*t).*sin(2*x); [x1, t1] ...

Plot 3D of a function

Are you looking for something like this? x = linspace(0,pi); t = linspace(0,1); z = @(x,t) 10*exp(-4*t).*sin(2*x); [x1, t1] ...

7 jours ago | 0

| accepted

Answered

Error using _*_. What am I doing wrong?

You need dots before the * and before the / , not after the t.

Error using _*_. What am I doing wrong?

You need dots before the * and before the / , not after the t.

8 jours ago | 1

Answered

Runge Kutta 4th Order Example

First, write your equation as two first order equations; xdot = v, say, and vdot = -9xdot - 0.1x^3 Then define two functions ...

Runge Kutta 4th Order Example

First, write your equation as two first order equations; xdot = v, say, and vdot = -9xdot - 0.1x^3 Then define two functions ...

8 jours ago | 1

Answered

Find intersection point between a vertical line and another line.

You could insert a conditional: AlineX=[0 0]; AlineY=[0 400]; BLineX=[1180 570]; BLineY=[-289.5 250]; p1 = polyfit(Alin...

Find intersection point between a vertical line and another line.

You could insert a conditional: AlineX=[0 0]; AlineY=[0 400]; BLineX=[1180 570]; BLineY=[-289.5 250]; p1 = polyfit(Alin...

8 jours ago | 1

| accepted

Answered

Solving second order inhomogeneous differential equations which are not a function of time

Break the ode into two first order ode's. e.g. dy/dx = v; dv/dx = f(x) - p*v - q*y; Look up the documentation on ode45 ...

Solving second order inhomogeneous differential equations which are not a function of time

Break the ode into two first order ode's. e.g. dy/dx = v; dv/dx = f(x) - p*v - q*y; Look up the documentation on ode45 ...

8 jours ago | 0

| accepted

Answered

Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters

Your line v(n)= 4(-1)^(n-1)/(2(n-1)+1)+pi_estimate should be v(n)= 4*(-1)^(n-1)/(2*(n-1)+1)+pi_estimate Note: | ...

Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters

Your line v(n)= 4(-1)^(n-1)/(2(n-1)+1)+pi_estimate should be v(n)= 4*(-1)^(n-1)/(2*(n-1)+1)+pi_estimate Note: | ...

8 jours ago | 0

Answered

How do I plotting Matlab functions, ode23, exact value functions side by side?

Like this format long r=5000; c=200*(10^(-6)); vs=10; tf=3; %%%%%%%%%%%%%%%%%%%%%%%%% %% 2 exact solution for charging an...

How do I plotting Matlab functions, ode23, exact value functions side by side?

Like this format long r=5000; c=200*(10^(-6)); vs=10; tf=3; %%%%%%%%%%%%%%%%%%%%%%%%% %% 2 exact solution for charging an...

8 jours ago | 1

| accepted

Answered

Where, T is the temperature in Kelvin, Beta (or β) is the thermal expansion coefficient (1/K), and Alpha (or α) is the thermal diffusivity (m2/s). Using MATLAB find the properties for T= 321, 440, and 571, respectively.

I get no error when running your script exactly as it is: ans = 3×3 table T Beta Alpha ___ _____...

Where, T is the temperature in Kelvin, Beta (or β) is the thermal expansion coefficient (1/K), and Alpha (or α) is the thermal diffusivity (m2/s). Using MATLAB find the properties for T= 321, 440, and 571, respectively.

I get no error when running your script exactly as it is: ans = 3×3 table T Beta Alpha ___ _____...

8 jours ago | 0

| accepted

Answered

Need to plot a graph of -y(t) and x(t) on MATLAB

Here are the equations that you will need to include in your pend function. Now let's see you implement them!

Need to plot a graph of -y(t) and x(t) on MATLAB

Here are the equations that you will need to include in your pend function. Now let's see you implement them!

8 jours ago | 0