Answered

how to I solve 2 eqns with 2 unknowns and plot 5 plots according to these solutions?

Here's a possible way. Only you will know if the results make sense deltaGrxn_std_rxn1 = -24800; %(J/mol) deltaHrxn_std_rxn1 ...

how to I solve 2 eqns with 2 unknowns and plot 5 plots according to these solutions?

Here's a possible way. Only you will know if the results make sense deltaGrxn_std_rxn1 = -24800; %(J/mol) deltaHrxn_std_rxn1 ...

1 month ago | 0

Answered

Why do I get different results from the numerical solution and the analytical solution with ODE15S? The numerical solution looks smoother than the analytical one

% replace m_Soil = m_Soil_initial .* exp(- k1(i) .* t_measured(i+1)); % by m_Soil = m_Soil_initial .* exp(- k1(i) .* (t_mea...

Why do I get different results from the numerical solution and the analytical solution with ODE15S? The numerical solution looks smoother than the analytical one

% replace m_Soil = m_Soil_initial .* exp(- k1(i) .* t_measured(i+1)); % by m_Soil = m_Soil_initial .* exp(- k1(i) .* (t_mea...

1 month ago | 1

| accepted

Answered

Why do I get different results from the numerical solution and the analytical solution with ODE15S? The numerical solution looks smoother than the analytical one

Much easier to follow! Your "analytical" solution is incorrect for "constants" that change with time. See the following %% Re...

Why do I get different results from the numerical solution and the analytical solution with ODE15S? The numerical solution looks smoother than the analytical one

Much easier to follow! Your "analytical" solution is incorrect for "constants" that change with time. See the following %% Re...

1 month ago | 0

Answered

must return a column vector

Do you want something like this sp=-0.5:0.5:14.5; for i = 1:length(sp) [t,y(:,i)]=ode45(@(t,y) phy_ode_1(t,y,sp(i)),0:0.5:1...

must return a column vector

Do you want something like this sp=-0.5:0.5:14.5; for i = 1:length(sp) [t,y(:,i)]=ode45(@(t,y) phy_ode_1(t,y,sp(i)),0:0.5:1...

1 month ago | 1

| accepted

Answered

Finding a range of data greater than 0.1

There must be a neater way, but the following might help: X = [ 0.02 0.17 0.32 0.28 0.04 -0.07 -0.01 -0.19 -0.45 ....

Finding a range of data greater than 0.1

There must be a neater way, but the following might help: X = [ 0.02 0.17 0.32 0.28 0.04 -0.07 -0.01 -0.19 -0.45 ....

1 month ago | 0

| accepted

Answered

How to use ode45 with a time dependant second order differential equation

Turn your second order equation into two simultaneous first order equations.

How to use ode45 with a time dependant second order differential equation

Turn your second order equation into two simultaneous first order equations.

1 month ago | 0

Answered

how can i solve this problem with rk4 method?

If m=20, k=20, c=40 then function f should be f = -(c/m)*v - k/m f=@(t,x,v) -2*v -x; %dvdt

how can i solve this problem with rk4 method?

If m=20, k=20, c=40 then function f should be f = -(c/m)*v - k/m f=@(t,x,v) -2*v -x; %dvdt

1 month ago | 0

| accepted

Answered

How to solve a function with different ranges

Try C_ox = [16;15;7.5;2;7.5;15;15]; C_ox(C_ox<=15)=C_ox(C_ox<=15)/15; C_ox(C_ox>15)=1

How to solve a function with different ranges

Try C_ox = [16;15;7.5;2;7.5;15;15]; C_ox(C_ox<=15)=C_ox(C_ox<=15)/15; C_ox(C_ox>15)=1

1 month ago | 0

Answered

how can i solve second order ODE with RK-4 without using a built in function in matlab?

This K11 = RK4(t(i), y1(:, i)); should be | K11 = RK4(t(i), y(:, i)); and this f12 = -3*y(1)+30*t+10; ...

how can i solve second order ODE with RK-4 without using a built in function in matlab?

This K11 = RK4(t(i), y1(:, i)); should be | K11 = RK4(t(i), y(:, i)); and this f12 = -3*y(1)+30*t+10; ...

1 month ago | 0

| accepted

Answered

How to design the membership function in matlab?

How about the following for rule 3 (I'll leave you to invert for rule 4). x = [-180 -90 -89.001 89.001 90 180]; y = (x+180)/90...

How to design the membership function in matlab?

How about the following for rule 3 (I'll leave you to invert for rule 4). x = [-180 -90 -89.001 89.001 90 180]; y = (x+180)/90...

1 month ago | 0

| accepted

Answered

Help for plotting graph. Can someone help me?

In your while loop you don't update either nErrorsBitsW or nErrorsBitsInf so they always stay at 0, and never reach minNbits.

Help for plotting graph. Can someone help me?

In your while loop you don't update either nErrorsBitsW or nErrorsBitsInf so they always stay at 0, and never reach minNbits.

1 month ago | 0

Answered

how I can insert these specific colours into my figures

Do you mean something like this? newcolors = [0 0.4470 0.7410; 0.8500 0.3250 0.0980; 0.9290 0.6940 0.1250...

how I can insert these specific colours into my figures

Do you mean something like this? newcolors = [0 0.4470 0.7410; 0.8500 0.3250 0.0980; 0.9290 0.6940 0.1250...

2 months ago | 1

| accepted

Answered

Transpose x from a row vector to a column vector using the transpose operator. The program is prompting the x does not have correct values. the code i have entered is below

You probably meant x = [1:5]; % ie the ; is after the ] However, it seems to work ok for me as you wrote it!

Transpose x from a row vector to a column vector using the transpose operator. The program is prompting the x does not have correct values. the code i have entered is below

You probably meant x = [1:5]; % ie the ; is after the ] However, it seems to work ok for me as you wrote it!

2 months ago | 0

Answered

Replace a entry of a table of Bisection Method for a specific term

Try using NaN or [ ];

Replace a entry of a table of Bisection Method for a specific term

Try using NaN or [ ];

2 months ago | 0

| accepted

Answered

Plotting the intersection of a composition function

Do you mean something like this? Sfn = @(x) (x+1/4).*(x<=1/2) + (x+3/4).*(x>1/2); x = linspace(0,1,100); n=10; S = zeros(n,n...

Plotting the intersection of a composition function

Do you mean something like this? Sfn = @(x) (x+1/4).*(x<=1/2) + (x+3/4).*(x>1/2); x = linspace(0,1,100); n=10; S = zeros(n,n...

2 months ago | 0

Answered

Sun Synchronous with For Loop

When I run the program you've listed above it produces the graph you show!

Sun Synchronous with For Loop

When I run the program you've listed above it produces the graph you show!

2 months ago | 0

| accepted

Answered

Integration of a function with variable parameter

Do you mean something like this? H = @(tau, lam, tt) lam./exp(tt-tau); T=50; step=1000; h=T/step; t=0:h:T; lambda = rand(1...

Integration of a function with variable parameter

Do you mean something like this? H = @(tau, lam, tt) lam./exp(tt-tau); T=50; step=1000; h=T/step; t=0:h:T; lambda = rand(1...

2 months ago | 0

| accepted

Answered

How to get sinusodial behaviour from 2nd order ode using function handle?

You coud try implementing the function along these lines (obviously, you will need to use your own values for alpha etc): alpha...

How to get sinusodial behaviour from 2nd order ode using function handle?

You coud try implementing the function along these lines (obviously, you will need to use your own values for alpha etc): alpha...

2 months ago | 0

Answered

How to find absolute maximum value of (x*(x-.25)*(x-.5)*(x-1))

You could just do something like gx = @(x) ((x.^4) -(1.75*x.^3)+(0.875*x.^2)-(0.125*x)); X = roots([4, -5.25, 1.75, -0.125]); ...

How to find absolute maximum value of (x*(x-.25)*(x-.5)*(x-1))

You could just do something like gx = @(x) ((x.^4) -(1.75*x.^3)+(0.875*x.^2)-(0.125*x)); X = roots([4, -5.25, 1.75, -0.125]); ...

2 months ago | 0

Answered

I want to see N,M first and then K,M in the same legend. I can see only N,M like the attached picture.

Do you mean like this? N = [10 20 30 40 50]; M = [1 2 3 4 5]; K=[1 3 5 6 7]; x = linspace(0, 1, 17); legendString = "N = " ...

I want to see N,M first and then K,M in the same legend. I can see only N,M like the attached picture.

Do you mean like this? N = [10 20 30 40 50]; M = [1 2 3 4 5]; K=[1 3 5 6 7]; x = linspace(0, 1, 17); legendString = "N = " ...

2 months ago | 0

| accepted

Answered

How to take integral with for loop?

Add the command I = sum(final); after the loop.

How to take integral with for loop?

Add the command I = sum(final); after the loop.

2 months ago | 0

| accepted

Answered

Solving queue problem iterating through array

Try Lock19(Lock19~=-5)=0; Lock19(Lock19==-5)=3;

Solving queue problem iterating through array

Try Lock19(Lock19~=-5)=0; Lock19(Lock19==-5)=3;

2 months ago | 0

Answered

Sum of even numbers

Like so s = test(6); disp(s) function s = test(n) if n <= 0 %for n<= 0 the result would be 0 s = 0; els...

Sum of even numbers

Like so s = test(6); disp(s) function s = test(n) if n <= 0 %for n<= 0 the result would be 0 s = 0; els...

2 months ago | 0

Answered

Stopping ode45 when encountering errors and retrieving results

The following makes your example work. However, I suspect your real problem is more complicated. If so, you should upload it. ...

Stopping ode45 when encountering errors and retrieving results

The following makes your example work. However, I suspect your real problem is more complicated. If so, you should upload it. ...

2 months ago | 0

Answered

After comma precision tracking for if statement

Here's one possibility a=85.0093792283283; b=85.0093791964294; a = floor(a*10^3); b = floor(b*10^3); if a==b disp('n...

After comma precision tracking for if statement

Here's one possibility a=85.0093792283283; b=85.0093791964294; a = floor(a*10^3); b = floor(b*10^3); if a==b disp('n...

2 months ago | 0

Answered

help me solve this if statement

Remove the ] in the top line! Then number = randi([0,9]) evens = [2,4,6,8]; odds = [1,3,5,7,9]; if ismember(number,evens) ...

help me solve this if statement

Remove the ] in the top line! Then number = randi([0,9]) evens = [2,4,6,8]; odds = [1,3,5,7,9]; if ismember(number,evens) ...

2 months ago | 0

Answered

Error: ode45 Must return a column vector?

Like this? % the total time domain response % System parameters k3 = 15; k1 = 10.0; k2 = 10.0; m1 = 2.0; m2 = 6.0; L = 1.0;...

Error: ode45 Must return a column vector?

Like this? % the total time domain response % System parameters k3 = 15; k1 = 10.0; k2 = 10.0; m1 = 2.0; m2 = 6.0; L = 1.0;...

2 months ago | 1

| accepted

Answered

How to solve following BVP ODE?

Weird ODE and initial boundary condition! You can solve for small values of x using the following (where y(x=0) was chosen by t...

How to solve following BVP ODE?

Weird ODE and initial boundary condition! You can solve for small values of x using the following (where y(x=0) was chosen by t...

2 months ago | 1

| accepted

Answered

Array indexes must be positive integers or logical values.

Looks like you are using SUM when you want sum. Change to: SUM= E1*sum(V(3:IOUT+1,JOUT+2)).... Also, in line 59, you should h...

Array indexes must be positive integers or logical values.

Looks like you are using SUM when you want sum. Change to: SUM= E1*sum(V(3:IOUT+1,JOUT+2)).... Also, in line 59, you should h...

2 months ago | 1

| accepted