Answered

plotting Solid of revolution of a function

How about: X = 0:0.1:pi; R = sin(X); [z,x,y] = cylinder(R); surf(x,y,z)

plotting Solid of revolution of a function

How about: X = 0:0.1:pi; R = sin(X); [z,x,y] = cylinder(R); surf(x,y,z)

3 mesi ago | 1

Answered

Split an array using specific points

Like this? Y = [5;2;3;6;7;9;5;5;6;3;8;7;74;9;63;47;10;3]; diiv = [5; 9; 15]; y1 = Y(1:diiv(1)); y2 = Y(diiv(1)+1:diiv(2)); ...

Split an array using specific points

Like this? Y = [5;2;3;6;7;9;5;5;6;3;8;7;74;9;63;47;10;3]; diiv = [5; 9; 15]; y1 = Y(1:diiv(1)); y2 = Y(diiv(1)+1:diiv(2)); ...

3 mesi ago | 1

Answered

Algorithm for Fractional power calculation

How about using the Newton-Raphson algorithm. Here's the basic idea: % x^n = b % Let f(x) = x^n - b % dfdx(x) = n*x^(n-1) %...

Algorithm for Fractional power calculation

How about using the Newton-Raphson algorithm. Here's the basic idea: % x^n = b % Let f(x) = x^n - b % dfdx(x) = n*x^(n-1) %...

3 mesi ago | 0

Answered

Stochastic differential equation Gompertz plotting a graph

You have x(1) = 0, so log(x(1)) is -Inf, which means that subsequent values of x will be NaNs.

Stochastic differential equation Gompertz plotting a graph

You have x(1) = 0, so log(x(1)) is -Inf, which means that subsequent values of x will be NaNs.

3 mesi ago | 0

| accepted

Answered

Defining integration function in matlanb

Like this? % If Cp is a constant then the integral is just Cp*T % If it is a function of T, then define the function: Cp = @(...

Defining integration function in matlanb

Like this? % If Cp is a constant then the integral is just Cp*T % If it is a function of T, then define the function: Cp = @(...

3 mesi ago | 0

Answered

Plotting and coding problems

More like this perhaps: T = 300:0.5:500; w = 0.224; Tc = 304.2; ...

Plotting and coding problems

More like this perhaps: T = 300:0.5:500; w = 0.224; Tc = 304.2; ...

3 mesi ago | 0

Answered

I am getting error, "array indices must be positive or logical integer values". Please help

You need multiplication signs between n and (w1+k) in calculations of u and z: [X,Y] = meshgrid(-4:0.2:4); n=2; k=1; %n=1,...

I am getting error, "array indices must be positive or logical integer values". Please help

You need multiplication signs between n and (w1+k) in calculations of u and z: [X,Y] = meshgrid(-4:0.2:4); n=2; k=1; %n=1,...

3 mesi ago | 0

Answered

Need help in finding all the solutions of non linear ellipse equations using Newtons Method using following code.

Check your Jacobian equations, especially the term: 2*x(1)+2*x(1)+4; I think this should be 2*x(1)+2*x(2)+4;

Need help in finding all the solutions of non linear ellipse equations using Newtons Method using following code.

Check your Jacobian equations, especially the term: 2*x(1)+2*x(1)+4; I think this should be 2*x(1)+2*x(2)+4;

3 mesi ago | 1

Answered

Displayin command just once for the n number of iterations

What about if k == 0 disp("Hello World!") elseif k == 480 disp("Bye Bye World!") end

Displayin command just once for the n number of iterations

What about if k == 0 disp("Hello World!") elseif k == 480 disp("Bye Bye World!") end

3 mesi ago | 0

Answered

Index in position 1 is invalid. Array indices must be positive integers or logical values.

In line V(i,j+1) = ((1-2*s-k).*V (i,j))+ (s.*(V (i-1,j) + V (i+1,j))) - (k.*(Rm.*Iinj+Vrest)); you have V (i-1,j). When i is ...

Index in position 1 is invalid. Array indices must be positive integers or logical values.

In line V(i,j+1) = ((1-2*s-k).*V (i,j))+ (s.*(V (i-1,j) + V (i+1,j))) - (k.*(Rm.*Iinj+Vrest)); you have V (i-1,j). When i is ...

3 mesi ago | 0

| accepted

Answered

What is the way of solving the noise added differential equations in matlab?

Try to avoid the (mis)use of global! %% ----------------INPUT PARAMETERS--------------------------- f=0.33; alpha=0.5; w0=sqrt...

What is the way of solving the noise added differential equations in matlab?

Try to avoid the (mis)use of global! %% ----------------INPUT PARAMETERS--------------------------- f=0.33; alpha=0.5; w0=sqrt...

3 mesi ago | 0

| accepted

Answered

Unable to perform assignment because the left and right sides have a different number of elements.

Like this? clear %Vmax values for each reaction step v1=0.01:0.01:2; v2=1; %Km values for each reaction step K1=1; K2=1; ...

Unable to perform assignment because the left and right sides have a different number of elements.

Like this? clear %Vmax values for each reaction step v1=0.01:0.01:2; v2=1; %Km values for each reaction step K1=1; K2=1; ...

3 mesi ago | 0

| accepted

Answered

How do I create a stacked plot like attached figure using subplot command ?

Try help stackedplot

How do I create a stacked plot like attached figure using subplot command ?

Try help stackedplot

3 mesi ago | 0

| accepted

Answered

Second order equations. Cauchy task

More like this: % Write equations as follows: % dudx = v u(0)=-1 % dvdx = -v/4-6u v(0)=0 % % Then you hav...

Second order equations. Cauchy task

More like this: % Write equations as follows: % dudx = v u(0)=-1 % dvdx = -v/4-6u v(0)=0 % % Then you hav...

3 mesi ago | 1

| accepted

Answered

Runge Kutta 3 ODE

You can't have t(i)=t(0)+i*h; indices must be a positive integer - you have t(0), Matlab doesn't like this!

Runge Kutta 3 ODE

You can't have t(i)=t(0)+i*h; indices must be a positive integer - you have t(0), Matlab doesn't like this!

3 mesi ago | 0

| accepted

Answered

Why it is saying this? Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in Homework (line 21) surf(x,y,F(i,j))

Like this x=[-5:5]; y=[-5:5]; for i=1:numel(x) for j=1:numel(y) if (x(i)>=0)&&(y(j)>=0) F(i,j)=2.*x(i)+y(j)^2; en...

Why it is saying this? Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in Homework (line 21) surf(x,y,F(i,j))

Like this x=[-5:5]; y=[-5:5]; for i=1:numel(x) for j=1:numel(y) if (x(i)>=0)&&(y(j)>=0) F(i,j)=2.*x(i)+y(j)^2; en...

3 mesi ago | 0

| accepted

Answered

Definite integral with parameter

You could try something like this: a = 0.043478; q = 100; % Ha W = 40; t = 4; c = @(x,Fa )(5.*x.^2-Fa.*x)./(((a.*x+q).*W-((...

Definite integral with parameter

You could try something like this: a = 0.043478; q = 100; % Ha W = 40; t = 4; c = @(x,Fa )(5.*x.^2-Fa.*x)./(((a.*x+q).*W-((...

4 mesi ago | 0

| accepted

Answered

Integration of a joint pdf with for loop?

When k = 1and i = 1 then k-i = 0, therefore the second index in fun(i,k-i) is 0, but indices must be positive integers in Matlab...

Integration of a joint pdf with for loop?

When k = 1and i = 1 then k-i = 0, therefore the second index in fun(i,k-i) is 0, but indices must be positive integers in Matlab...

4 mesi ago | 0

Answered

How would you I write a matlab function for theta that represents the 2nd order differential of the torque equation?

Does this help? % Theta seems to have two components, so: D(theta) = [p1+p2+2*p3*cos(theta(2)) p2+p3*cos(theta(2)); ...

How would you I write a matlab function for theta that represents the 2nd order differential of the torque equation?

Does this help? % Theta seems to have two components, so: D(theta) = [p1+p2+2*p3*cos(theta(2)) p2+p3*cos(theta(2)); ...

4 mesi ago | 1

| accepted

Answered

Error message with arrays

You only need h = [2:20:220]; t_a = 293; q_flux = 800; n = length(h); y = q_flux./h+t_a; i = i+1; plot(h,y)...

Error message with arrays

You only need h = [2:20:220]; t_a = 293; q_flux = 800; n = length(h); y = q_flux./h+t_a; i = i+1; plot(h,y)...

4 mesi ago | 0

Answered

How to solve two coupled differential equations using ode45.

"Why is my previous code is not working properly by treating the problem to be a DAE." I don't know! "Also I noticed you wrote...

How to solve two coupled differential equations using ode45.

"Why is my previous code is not working properly by treating the problem to be a DAE." I don't know! "Also I noticed you wrote...

4 mesi ago | 1

Answered

Multiple Anonym Function return wrong values

Here's one solution: C = [4622 5480 18923]*1e-12; U = [454e3 454e3-20e3 20e3].*sqrt(2); W = Energy(C,U); disp(W) function W...

Multiple Anonym Function return wrong values

Here's one solution: C = [4622 5480 18923]*1e-12; U = [454e3 454e3-20e3 20e3].*sqrt(2); W = Energy(C,U); disp(W) function W...

4 mesi ago | 0

| accepted

Answered

Hi, is it possible to have variables in an ode45 that varies according to another function?

Put something like [T, p, rho, speedsound] = atmos(height); immediately after height = x(1); in function dynameqn. Not sur...

Hi, is it possible to have variables in an ode45 that varies according to another function?

Put something like [T, p, rho, speedsound] = atmos(height); immediately after height = x(1); in function dynameqn. Not sur...

4 mesi ago | 0

Answered

root finding and plot of graph

Are you looking for something like this? hi = 1e-6; lo = 1e-9; n = 500; dt = (hi-lo)/n; t3 = lo:dt:hi; y = f(t3); subplo...

root finding and plot of graph

Are you looking for something like this? hi = 1e-6; lo = 1e-9; n = 500; dt = (hi-lo)/n; t3 = lo:dt:hi; y = f(t3); subplo...

4 mesi ago | 0

Answered

Calculator result and MATLAB result are different

Have you checked that both are using degrees, or both radians? The Matlab as you've written it is using radians (use sind(24) a...

Calculator result and MATLAB result are different

Have you checked that both are using degrees, or both radians? The Matlab as you've written it is using radians (use sind(24) a...

4 mesi ago | 1

Answered

How can I rotate a set of points by an angle around its origin?

Do you mean like this? ITM = [461400.0758 617474.3059 461400.8069 617475.4609 461400.8069 617475.4609 461402.3069 617477.633...

How can I rotate a set of points by an angle around its origin?

Do you mean like this? ITM = [461400.0758 617474.3059 461400.8069 617475.4609 461400.8069 617475.4609 461402.3069 617477.633...

4 mesi ago | 1

| accepted

Answered

Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.

Try replacing x(4) = Velocities(3608.9,5249.3); by x(4,:) = Velocities(3608.9,5249.3); Same for x(5).

Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.

Try replacing x(4) = Velocities(3608.9,5249.3); by x(4,:) = Velocities(3608.9,5249.3); Same for x(5).

4 mesi ago | 0

Answered

Removing zeros from matrix

Like this? A = [1 2 3 4 5 6; 1 2 3 4 5 6; 1 2 3 4 5 0; 1 2 3 4 0 0; 1 2 3 0 0 0]; B = A'; B=B(:); B(B==0)=[]

Removing zeros from matrix

Like this? A = [1 2 3 4 5 6; 1 2 3 4 5 6; 1 2 3 4 5 0; 1 2 3 4 0 0; 1 2 3 0 0 0]; B = A'; B=B(:); B(B==0)=[]

5 mesi ago | 0

Answered

Error in ODE arguments

I suspect you mean like this (notice the way M divides, using the back-slash): % Numerical solution of IVP % M*xddot + C*x...

Error in ODE arguments

I suspect you mean like this (notice the way M divides, using the back-slash): % Numerical solution of IVP % M*xddot + C*x...

5 mesi ago | 2

| accepted

Answered

How to Approximate The Solution for an Initial Value Problem?

Try f = @(t,x) [x(2); sin(1.9*t)-4*x(1)]; [t,x] = ode45(f,[0,150],[1,0]); plot(t,x)

How to Approximate The Solution for an Initial Value Problem?

Try f = @(t,x) [x(2); sin(1.9*t)-4*x(1)]; [t,x] = ode45(f,[0,150],[1,0]); plot(t,x)

6 mesi ago | 1

| accepted