Knowledge means knowing where it is written...

Interested in:

- Optimization

- Mathematical Modelling

- Improvement of my programming skills

Answered

Fill a vector with two vectors

V1 = [3 8 6 7] V2 = [1 5 9 4] V = reshape([V1;V2],1,[]) V = V(3:end) results in: V1 = 3 8 6 7 V2 =...

Fill a vector with two vectors

V1 = [3 8 6 7] V2 = [1 5 9 4] V = reshape([V1;V2],1,[]) V = V(3:end) results in: V1 = 3 8 6 7 V2 =...

21 minutos ago | 0

Answered

Trying to plot this curve what have I done wrong?

fun = @(x)(18*sqrt(2)*(sqrt(1+1./(1+x.^2)) + asin(1./(1+x.^2)-pi/2))) fplot(fun)

Trying to plot this curve what have I done wrong?

fun = @(x)(18*sqrt(2)*(sqrt(1+1./(1+x.^2)) + asin(1./(1+x.^2)-pi/2))) fplot(fun)

alrededor de 1 hora ago | 0

Answered

How to find the solution of inverse function ?

x = [1 2 3 4 5 6 7]; y = [3.6 1.8 1.2 0.9 0.72 1.5 0.51429]; p = polyfit(x,y,2) syms x fx(x) = poly2sym(p) gx(x) = finvers...

How to find the solution of inverse function ?

x = [1 2 3 4 5 6 7]; y = [3.6 1.8 1.2 0.9 0.72 1.5 0.51429]; p = polyfit(x,y,2) syms x fx(x) = poly2sym(p) gx(x) = finvers...

alrededor de 2 horas ago | 0

| accepted

Answered

Possible combinations for a vector

You could use allcomb from FEX: k = 0:2; coms = allcomb(k,k,k,k,k,k,k,k,k); as expected there are 3^9 = 19683 results

Possible combinations for a vector

You could use allcomb from FEX: k = 0:2; coms = allcomb(k,k,k,k,k,k,k,k,k); as expected there are 3^9 = 19683 results

alrededor de 3 horas ago | 1

| accepted

Answered

how do i write a matlab script to sum this expression?

Symbolic: syms n positive integer N = 10000; eq = 1/n + 1/((n+2)*(n+3)); pretty(eq) sol = symsum(eq,n,1,N) sol_num = doubl...

how do i write a matlab script to sum this expression?

Symbolic: syms n positive integer N = 10000; eq = 1/n + 1/((n+2)*(n+3)); pretty(eq) sol = symsum(eq,n,1,N) sol_num = doubl...

alrededor de 5 horas ago | 1

Answered

ODE Function time output

Use events: Z0 = 6; Zt=0.05*6; tspan = [0 24]; opts = odeset('Events',@(tZ,Z)EventsFcn(tZ,Z,Zt)); [tZ,Z,tZe,Ze,iZe] = ode45...

ODE Function time output

Use events: Z0 = 6; Zt=0.05*6; tspan = [0 24]; opts = odeset('Events',@(tZ,Z)EventsFcn(tZ,Z,Zt)); [tZ,Z,tZe,Ze,iZe] = ode45...

alrededor de 16 horas ago | 0

| accepted

Answered

Why isn't my code graph anything.

Try: %create a cater plot clear all; %x = [20,30,40,50] x = [-3,-1,1,2] y = [8,23,28,34] y=[8,23,28,34].' colum = [...

Why isn't my code graph anything.

Try: %create a cater plot clear all; %x = [20,30,40,50] x = [-3,-1,1,2] y = [8,23,28,34] y=[8,23,28,34].' colum = [...

alrededor de 16 horas ago | 0

Answered

How find symbolic solution matlab

It appears that there either is no symbolic solution or Matlab is not powerful enough to find one. For sin(t) it would work. How...

How find symbolic solution matlab

It appears that there either is no symbolic solution or Matlab is not powerful enough to find one. For sin(t) it would work. How...

alrededor de 17 horas ago | 1

Answered

ode 45 and for loop

k = 0; T_sol = cell(1,100); X_sol = cell(1,100); for ii = 0.1:0.1:10 k = k+1; [T,X] = ode45(@(t,x)fx(t,x,ii), [0 ...

ode 45 and for loop

k = 0; T_sol = cell(1,100); X_sol = cell(1,100); for ii = 0.1:0.1:10 k = k+1; [T,X] = ode45(@(t,x)fx(t,x,ii), [0 ...

alrededor de 23 horas ago | 0

| accepted

Answered

Graph Plotting the differential equation

yyaxis left fplot(qSol,[0, 100]) yyaxis right fplot(TSol,[0, 100])

Graph Plotting the differential equation

yyaxis left fplot(qSol,[0, 100]) yyaxis right fplot(TSol,[0, 100])

alrededor de 23 horas ago | 1

| accepted

Answered

Defining function file of ODE function

C0 = 5; tspan = [0 10]; [t,C] = ode45(@Conc,tspan,C0); plot(t,C) function dCdt=Conc(t,C) k1=0.7; Vo=1; Q=Vo; Cin=200; ...

Defining function file of ODE function

C0 = 5; tspan = [0 10]; [t,C] = ode45(@Conc,tspan,C0); plot(t,C) function dCdt=Conc(t,C) k1=0.7; Vo=1; Q=Vo; Cin=200; ...

1 día ago | 1

| accepted

Answered

How do i plot this quadratic graph?

x = -10:10; y = polyval([1 -2 -4],x); plot(x,y) r = roots([1 -2 -4]) text(r(1),0,'\leftarrow Root') text(r(2),0,'\leftarrow...

How do i plot this quadratic graph?

x = -10:10; y = polyval([1 -2 -4],x); plot(x,y) r = roots([1 -2 -4]) text(r(1),0,'\leftarrow Root') text(r(2),0,'\leftarrow...

1 día ago | 0

Answered

Solve a Matrix equation

Symbolic approach: A = sym('A', [4,1]) B = magic(4) P = 13 sol = solve(A'*B*A==P, A) sol.A1 sol.A2 sol.A3 sol.A4 % This...

Solve a Matrix equation

Symbolic approach: A = sym('A', [4,1]) B = magic(4) P = 13 sol = solve(A'*B*A==P, A) sol.A1 sol.A2 sol.A3 sol.A4 % This...

1 día ago | 0

Answered

Suppose that at any given time t (in seconds) the current i (in amperes) in an alternating current circuit is i = 2 cos t + 2 sin t. What is the peak current for this circuit (largest magnitude)?

Do the same as shown in your question before. Then use diff(...) == 0 to find extremum points. The solve function maybe helpfu...

Suppose that at any given time t (in seconds) the current i (in amperes) in an alternating current circuit is i = 2 cos t + 2 sin t. What is the peak current for this circuit (largest magnitude)?

Do the same as shown in your question before. Then use diff(...) == 0 to find extremum points. The solve function maybe helpfu...

1 día ago | 1

| accepted

Answered

unable to find symbolic solution

1. The condition for the second ode is invalid - i assume you meant: cond = T(R)==T0; instead of cond = q(R)==T0; 2. As...

unable to find symbolic solution

1. The condition for the second ode is invalid - i assume you meant: cond = T(R)==T0; instead of cond = q(R)==T0; 2. As...

1 día ago | 1

| accepted

Answered

Find intersection point between u(t) = t^2(t-1) and u = 10.

Simply use the function you calculated: >> t_sol = vpasolve(uSol == 10,t) ans = ...

Find intersection point between u(t) = t^2(t-1) and u = 10.

Simply use the function you calculated: >> t_sol = vpasolve(uSol == 10,t) ans = ...

1 día ago | 1

| accepted

Answered

Error using evalin Undefined function or variable 'x'. Error in sym/eval (line 11) s = evalin('caller',vectorize(map2mat(char(x))));

clear AC=0.15; BC=0.2; AD=0.35; xA=0; yA=0; rA=[xA yA 0]; xC=AC; yC=0; rC=[xC yC 0]; syms xBsol yBsol ii=0; for ph...

Error using evalin Undefined function or variable 'x'. Error in sym/eval (line 11) s = evalin('caller',vectorize(map2mat(char(x))));

clear AC=0.15; BC=0.2; AD=0.35; xA=0; yA=0; rA=[xA yA 0]; xC=AC; yC=0; rC=[xC yC 0]; syms xBsol yBsol ii=0; for ph...

1 día ago | 1

| accepted

Answered

find the equation of tangent to the curve y=2(x^1/2) at (1,2)

https://de.mathworks.com/help/symbolic/syms.html#buoeaym-1 https://de.mathworks.com/help/symbolic/diff.html

find the equation of tangent to the curve y=2(x^1/2) at (1,2)

https://de.mathworks.com/help/symbolic/syms.html#buoeaym-1 https://de.mathworks.com/help/symbolic/diff.html

1 día ago | 1

| accepted

Answered

How to find the solution for the system of equations

Your system is inconstistent and therefore there is no solution: % x is shorter than lambda x = sym('x', [14 1]) ; % system...

How to find the solution for the system of equations

Your system is inconstistent and therefore there is no solution: % x is shorter than lambda x = sym('x', [14 1]) ; % system...

1 día ago | 0

| accepted

Answered

How can I delete even rows in a matlab Matrix

>> A = [1 2 3; 4 5 6; 7 8 9; 0 -1 -2] A = 1 2 3 4 5 6 7 8 9 0 -1 -2 ...

How can I delete even rows in a matlab Matrix

>> A = [1 2 3; 4 5 6; 7 8 9; 0 -1 -2] A = 1 2 3 4 5 6 7 8 9 0 -1 -2 ...

1 día ago | 0

| accepted

Answered

ode45 Two Variable Differential equation Problem - Too many inputs error

Fixed the input in your functin. Rising t>7 gives warning, since the problem appears to be stiff: %% Initial Conditions: % Ini...

ode45 Two Variable Differential equation Problem - Too many inputs error

Fixed the input in your functin. Rising t>7 gives warning, since the problem appears to be stiff: %% Initial Conditions: % Ini...

1 día ago | 0

| accepted

Answered

Graphing using Matlab. How would you graph a function using matlab?

a = 24; b = 4.8; ii = 0:20; y = a + b.*ii; plot(ii,y)

Graphing using Matlab. How would you graph a function using matlab?

a = 24; b = 4.8; ii = 0:20; y = a + b.*ii; plot(ii,y)

1 día ago | 0

Answered

Please explain what this error is...

Your function has to be called with 2 inputs a and b for example when a=2 and b=5: [res1, res2, res3] = MyFun(2, 5)

Please explain what this error is...

Your function has to be called with 2 inputs a and b for example when a=2 and b=5: [res1, res2, res3] = MyFun(2, 5)

3 días ago | 0

Answered

Can anyone help me fix that error please

You missed to define several variables, which are used in your equations: % several used variables are not defined! - i set the...

Can anyone help me fix that error please

You missed to define several variables, which are used in your equations: % several used variables are not defined! - i set the...

4 días ago | 0

Answered

fsolve with one variabel

Tinc = 5+273; Tinv = 45+273; mv = 1000; Cpv = 4180; A = 0.032*(21-2); h = 20; U = ...

fsolve with one variabel

Tinc = 5+273; Tinv = 45+273; mv = 1000; Cpv = 4180; A = 0.032*(21-2); h = 20; U = ...

5 días ago | 2

Answered

Find the value which causes an error from a vector

This works with logical indexing, therefore avoids the if / else logic and should ensure that you do not need any error messages...

Find the value which causes an error from a vector

This works with logical indexing, therefore avoids the if / else logic and should ensure that you do not need any error messages...

6 días ago | 0

Answered

I get this error 'index in position 1 is invalid. Array indices must be positive integers or logical values.' when I am trying to store values from a for loop into a vector.

n = 9; % set the number of Monte Carlo repetitions M = 10000; % create M*1 vectors to save the realized sample statisti...

I get this error 'index in position 1 is invalid. Array indices must be positive integers or logical values.' when I am trying to store values from a for loop into a vector.

n = 9; % set the number of Monte Carlo repetitions M = 10000; % create M*1 vectors to save the realized sample statisti...

6 días ago | 0

| accepted

Answered

How to resolve the error of "Consider preallocating for speed" which is coming on executing the program below??

The answer is here: <https://de.mathworks.com/help/matlab/matlab_prog/preallocating-arrays.html>

How to resolve the error of "Consider preallocating for speed" which is coming on executing the program below??

The answer is here: <https://de.mathworks.com/help/matlab/matlab_prog/preallocating-arrays.html>

6 días ago | 0

Answered

Solving System of two Differential Equations with one initial and one end condition

Symbolic appears to work: syms Th(x) Tc(x) m_hp = 20; m_cp = 5; cw = 1; Rw = 1; eq(1) = diff(Th,x) == -1 / ((m_hp / 2) *...

Solving System of two Differential Equations with one initial and one end condition

Symbolic appears to work: syms Th(x) Tc(x) m_hp = 20; m_cp = 5; cw = 1; Rw = 1; eq(1) = diff(Th,x) == -1 / ((m_hp / 2) *...

7 días ago | 1

| accepted

Answered

2 values for inputs of a function

In case of a vectorized function (yours is) you can use vector inputs: b = 5; c = [25; 60]; d = 0; [T, L] = answ(b,c,d) ...

2 values for inputs of a function

In case of a vectorized function (yours is) you can use vector inputs: b = 5; c = [25; 60]; d = 0; [T, L] = answ(b,c,d) ...

7 días ago | 0