Answered

How to create a new variable in each iteration of the for loop?

One way as follows: y = 1024; %for example winSize=[16,64,256,1024,4096]; for i = 1:numel(winSize) if winSize(i) == 16 ...

How to create a new variable in each iteration of the for loop?

One way as follows: y = 1024; %for example winSize=[16,64,256,1024,4096]; for i = 1:numel(winSize) if winSize(i) == 16 ...

18 hours ago | 0

| accepted

Answered

Non-Linear Coupled First-Order ODEs (with multiple derivative terms in each equation).

These ode's can be rearranged as follows: As long as you know initial values for a, b and c, then given that you know everyth...

Non-Linear Coupled First-Order ODEs (with multiple derivative terms in each equation).

These ode's can be rearranged as follows: As long as you know initial values for a, b and c, then given that you know everyth...

1 day ago | 0

| accepted

Answered

How can i make the integral curves?

Like so? [x,y] = meshgrid(1:0.5:6,-3:0.5:2); u = ones(size(x)); v = (x.*y+y.^3)/2*x.^2; r = sqrt(u.^2 + v.^2); plot([0,0],[...

How can i make the integral curves?

Like so? [x,y] = meshgrid(1:0.5:6,-3:0.5:2); u = ones(size(x)); v = (x.*y+y.^3)/2*x.^2; r = sqrt(u.^2 + v.^2); plot([0,0],[...

3 days ago | 0

| accepted

Answered

Convert one matrix to two matrices with the order of the initial matrix

Try r1 = r; r1(:,2:2:end) = 0; r2 = r; r2(:,1:2:end) = 0;

Convert one matrix to two matrices with the order of the initial matrix

Try r1 = r; r1(:,2:2:end) = 0; r2 = r; r2(:,1:2:end) = 0;

3 days ago | 1

| accepted

Answered

How to clump/consolidate values together using the mean function

Here's one way cw = 4; %cell width a = 1:8; b = (1:8)'; c = a.*b; mat=ones(8,8); %temporary matrix avfn = @(m) mean(m,'A...

How to clump/consolidate values together using the mean function

Here's one way cw = 4; %cell width a = 1:8; b = (1:8)'; c = a.*b; mat=ones(8,8); %temporary matrix avfn = @(m) mean(m,'A...

3 days ago | 0

Answered

solve non linear equations

Add these lines at the end to get the values of S and J Soln = vpasolve([eqn1, eqn2],[S, J],[1 1]); disp(Soln.S) disp(Soln.J)...

solve non linear equations

Add these lines at the end to get the values of S and J Soln = vpasolve([eqn1, eqn2],[S, J],[1 1]); disp(Soln.S) disp(Soln.J)...

3 days ago | 0

Answered

How to find an unknown in an integral equation

Here's one way: nA0 = 1; % Initial guess nA = fzero(@fn, nA0); disp(nA) function Z = fn(nA) alphaA = 0.52; T ...

How to find an unknown in an integral equation

Here's one way: nA0 = 1; % Initial guess nA = fzero(@fn, nA0); disp(nA) function Z = fn(nA) alphaA = 0.52; T ...

4 days ago | 0

| accepted

Answered

Error: Function definition not supported in this context. Create functions in code file.

You need to turn Z=sin(2*pi*fc*p)./(pi*p); %Define truncated Sinc function% into Z=sin(2*pi*fc*p)./(pi*p); %Define trunca...

Error: Function definition not supported in this context. Create functions in code file.

You need to turn Z=sin(2*pi*fc*p)./(pi*p); %Define truncated Sinc function% into Z=sin(2*pi*fc*p)./(pi*p); %Define trunca...

4 days ago | 1

Answered

Using a another function within ODE45

More like this (but note the comments near the end): %Default Values m_c = 2; % Container Mass s1 = 16; ...

Using a another function within ODE45

More like this (but note the comments near the end): %Default Values m_c = 2; % Container Mass s1 = 16; ...

4 days ago | 1

| accepted

Answered

Conditionals within ODE45

You could try the following simplistic approach %Default Values m_c = 2; % Container Mass s1 = 16; % Sp...

Conditionals within ODE45

You could try the following simplistic approach %Default Values m_c = 2; % Container Mass s1 = 16; % Sp...

4 days ago | 1

| accepted

Answered

Need Help..............Error using stem (line 43) X must be same length as Y.

Either you want stem(t,xaa); or you want to use t1 in the definitions of xa11, xa22 etc.

Need Help..............Error using stem (line 43) X must be same length as Y.

Either you want stem(t,xaa); or you want to use t1 in the definitions of xa11, xa22 etc.

5 days ago | 1

Answered

What am I doing wrong here I keep getting a plot with either to many things on it or not enough all I want is a plot with two y axis and an x axis

Like this g = 9.81; theta = 46.97; theta2= 55; v1= 13.5; v2= 16.05; x= (0:0.1:2.3); x2= (0:0.1:5.14); y= x*tan(the...

What am I doing wrong here I keep getting a plot with either to many things on it or not enough all I want is a plot with two y axis and an x axis

Like this g = 9.81; theta = 46.97; theta2= 55; v1= 13.5; v2= 16.05; x= (0:0.1:2.3); x2= (0:0.1:5.14); y= x*tan(the...

5 days ago | 0

| accepted

Answered

Two linear equation with absolute value equation

Do you mean something like this X0 = [-50 -5]; [X, Fval] = fminsearch(@(X) fn(X),X0); x2 = X(1); x1 = 50-x2; x4 = X(2); x3 =...

Two linear equation with absolute value equation

Do you mean something like this X0 = [-50 -5]; [X, Fval] = fminsearch(@(X) fn(X),X0); x2 = X(1); x1 = 50-x2; x4 = X(2); x3 =...

5 days ago | 1

Answered

10%+10%

Because the % symbol indicates that the rest of the line is a comment. So the only non comment parameter Matlab sees is the fir...

10%+10%

Because the % symbol indicates that the rest of the line is a comment. So the only non comment parameter Matlab sees is the fir...

5 days ago | 1

| accepted

Answered

Function handling problem in loop

Try doc str2num to convert from text to numeric. Also, you might find it easier to define: k = [5.16 5.12 4.89 4.79 4.99 5.4...

Function handling problem in loop

Try doc str2num to convert from text to numeric. Also, you might find it easier to define: k = [5.16 5.12 4.89 4.79 4.99 5.4...

5 days ago | 0

| accepted

Answered

I can't randomly distribute the dots

Try using Yikikz=rand(size(Elevation)).*Elevation;

I can't randomly distribute the dots

Try using Yikikz=rand(size(Elevation)).*Elevation;

5 days ago | 1

Answered

How to fix error in fsolve

Is it just a case of changing F(1) = X(1) - exp(13.5-(2700/(x(3)-55))); to F(1) = x(1) - exp(13.5-(2700/(x(3)-55)));

How to fix error in fsolve

Is it just a case of changing F(1) = X(1) - exp(13.5-(2700/(x(3)-55))); to F(1) = x(1) - exp(13.5-(2700/(x(3)-55)));

6 days ago | 1

Answered

Error in using Integration, How to fix it ?

Since x has t in the denominator. t=0 will cause problems, so start at t = 0.02 instead, perhaps! This would require a change i...

Error in using Integration, How to fix it ?

Since x has t in the denominator. t=0 will cause problems, so start at t = 0.02 instead, perhaps! This would require a change i...

6 days ago | 0

| accepted

Answered

Ode and monod solver

Your equation has the following analytic solution (assuming Xa is a constant): You can plug in the known values for S0 (ie. t...

Ode and monod solver

Your equation has the following analytic solution (assuming Xa is a constant): You can plug in the known values for S0 (ie. t...

6 days ago | 1

| accepted

Answered

How to plot a large data set with markers to differentiate two overlapping lines?

How about plotting every n points. For example plot(t(1:1000:end),n_d(1:1000:end),'o') hold on plot(t(500:1000:end),n_r(500:...

How to plot a large data set with markers to differentiate two overlapping lines?

How about plotting every n points. For example plot(t(1:1000:end),n_d(1:1000:end),'o') hold on plot(t(500:1000:end),n_r(500:...

8 days ago | 0

| accepted

Answered

there is also a mistake here i can't recognize it , please help

You need N = [-V3*cos(th3(ii))-40*W2(ii).^2*cos(th2(ii))+C(ii)*W3(ii).^2*cos(th3(ii))+V3*W3(ii)*sin(th3(ii)); V3*sin(t...

there is also a mistake here i can't recognize it , please help

You need N = [-V3*cos(th3(ii))-40*W2(ii).^2*cos(th2(ii))+C(ii)*W3(ii).^2*cos(th3(ii))+V3*W3(ii)*sin(th3(ii)); V3*sin(t...

8 days ago | 0

Answered

How to vectorize this function?

You need a ./ (i.e. dot /) x3=@(phi) (R-((3-2.*sin(phi))./(1-0.5.*sin(phi)).*R)/4).*cos(phi) ...

How to vectorize this function?

You need a ./ (i.e. dot /) x3=@(phi) (R-((3-2.*sin(phi))./(1-0.5.*sin(phi)).*R)/4).*cos(phi) ...

8 days ago | 0

Answered

Plotting graph with Alpha and spectral radius

It works if you set i = 0.1:0.1:10. With i = 0; the inverse of S is full of Inf's.

Plotting graph with Alpha and spectral radius

It works if you set i = 0.1:0.1:10. With i = 0; the inverse of S is full of Inf's.

8 days ago | 0

| accepted

Answered

Conditional with time in ode45

Include upsilon within the odefcn mu = 6.25e10^-3; eta = 6.25e10^-3; beta = 0.03813350836; gamma = 0.01165323939; delta = 1...

Conditional with time in ode45

Include upsilon within the odefcn mu = 6.25e10^-3; eta = 6.25e10^-3; beta = 0.03813350836; gamma = 0.01165323939; delta = 1...

8 days ago | 0

| accepted

Answered

what's wrong with this code. why it show error can anyone tell?

You probably want something like this (don't enclose it with the statement 'function matlab' - that won't work). Remember to in...

what's wrong with this code. why it show error can anyone tell?

You probably want something like this (don't enclose it with the statement 'function matlab' - that won't work). Remember to in...

8 days ago | 0

Answered

Plot with 2 parameters

Do you mean something like this: theta = -90:90; ri = 0.5; ro = 1.5; x = [ri*cosd(theta) ro*cosd(-theta) 0]; y = [ri*sind(th...

Plot with 2 parameters

Do you mean something like this: theta = -90:90; ri = 0.5; ro = 1.5; x = [ri*cosd(theta) ro*cosd(-theta) 0]; y = [ri*sind(th...

9 days ago | 1

Answered

Please, how can I solve runKut4 in line 6?

Try t = 0.0; tStop = 6.0; y = [1.5 0]; h = 0.1; [T,Y] = ode45(@dEqs,[0 tStop],y); plot(T,Y(:,1),'ko-') xlabel('time (s)')...

Please, how can I solve runKut4 in line 6?

Try t = 0.0; tStop = 6.0; y = [1.5 0]; h = 0.1; [T,Y] = ode45(@dEqs,[0 tStop],y); plot(T,Y(:,1),'ko-') xlabel('time (s)')...

10 days ago | 0

| accepted

Answered

ode45 function matrix dimensions problem

You need to loop through the Y_H values. See below global mu_H Ks X_BH teta Ss_in mu_Hmax=0.15; %days^-1 T=22.6; %centigrad...

ode45 function matrix dimensions problem

You need to loop through the Y_H values. See below global mu_H Ks X_BH teta Ss_in mu_Hmax=0.15; %days^-1 T=22.6; %centigrad...

10 days ago | 0

Answered

I am getting this error "Assignment has more non-singleton rhs dimensions than non-singleton subscripts". Please help. Mw, Cw and Kw are 243X243 matrices.

It gets past your indicated Error line for me, but fails because you haven't defined Mw, Cw or Kw.

I am getting this error "Assignment has more non-singleton rhs dimensions than non-singleton subscripts". Please help. Mw, Cw and Kw are 243X243 matrices.

It gets past your indicated Error line for me, but fails because you haven't defined Mw, Cw or Kw.

10 days ago | 0

Answered

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

There are a lot of missing indices and definitions. In the following the indices are repaired; however, you will need to define ...

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

There are a lot of missing indices and definitions. In the following the indices are repaired; however, you will need to define ...

10 days ago | 0

| accepted