Answered

Solving equation with symbolic vector variable

use the dot-notation a = [1 2 3 4]; x = sym('x', [1 4]); eqn = a + 4.*x == x; sol_x = vpasolve(eqn, x) sol_x.x1 sol_x.x2 ...

Solving equation with symbolic vector variable

use the dot-notation a = [1 2 3 4]; x = sym('x', [1 4]); eqn = a + 4.*x == x; sol_x = vpasolve(eqn, x) sol_x.x1 sol_x.x2 ...

28 days ago | 1

| accepted

Answered

Splitting time into hours : minutes : seconds from a fractional value.

I guess 15.76 means hours in decimal numbers: [h,m,s] = hms(hours(15.76)) d = duration(h,m,s) gives: h = 15 m = ...

Splitting time into hours : minutes : seconds from a fractional value.

I guess 15.76 means hours in decimal numbers: [h,m,s] = hms(hours(15.76)) d = duration(h,m,s) gives: h = 15 m = ...

28 days ago | 0

| accepted

Answered

Why linsolve cannot solve this very simple equation?

To solve this, the rank should be 3. Row 1 and 3 are not linear independent. A = [4,2,2; 5,1,3; 6,0,4] B = [60; 70; 80]; r1...

Why linsolve cannot solve this very simple equation?

To solve this, the rank should be 3. Row 1 and 3 are not linear independent. A = [4,2,2; 5,1,3; 6,0,4] B = [60; 70; 80]; r1...

28 days ago | 0

| accepted

Answered

Why find cannot handle this very simple task?

You are dealing with doubles, they are not precisly 0.077 - use round: X = -0.1:.001:.25; find(round(X,3) == .077)

Why find cannot handle this very simple task?

You are dealing with doubles, they are not precisly 0.077 - use round: X = -0.1:.001:.25; find(round(X,3) == .077)

28 days ago | 0

Answered

Storing datetime double in a table

%%%Set this to desired sheet sheet = 'Test'; %Sets Date time format for when table is read opts = detectImportOptions("Weat...

Storing datetime double in a table

%%%Set this to desired sheet sheet = 'Test'; %Sets Date time format for when table is read opts = detectImportOptions("Weat...

29 days ago | 1

Answered

step respone, impulse response

s=tf('s'); kb=52; k1=156; k2=53; G1=10/(s+0.01); G2=G1/(1+kb*G1); G3=G2*k2*k1; G4=G3/(G3+1); subplot(2,1,1) impulse(G...

step respone, impulse response

s=tf('s'); kb=52; k1=156; k2=53; G1=10/(s+0.01); G2=G1/(1+kb*G1); G3=G2*k2*k1; G4=G3/(G3+1); subplot(2,1,1) impulse(G...

29 days ago | 0

Answered

How can I do such a "countifs"(excel) process in Matlab?

You do it by logical indexing: A = randi(10,1,15) CountIf = numel(A(A>5)) gives: A = 9 7 4 10 1 5...

How can I do such a "countifs"(excel) process in Matlab?

You do it by logical indexing: A = randi(10,1,15) CountIf = numel(A(A>5)) gives: A = 9 7 4 10 1 5...

29 days ago | 1

Answered

Dijkstra's Algorithm

You could make life easier using Matlab inbuilt graphs functions. One example is <https://de.mathworks.com/help/matlab/ref/graph...

Dijkstra's Algorithm

You could make life easier using Matlab inbuilt graphs functions. One example is <https://de.mathworks.com/help/matlab/ref/graph...

30 days ago | 0

Answered

How to find the sum of duration if the consecutive row elements are the same?

Save the durations you calculated using *|diff|* in an additional column so that the durations are correct for every row in your...

How to find the sum of duration if the consecutive row elements are the same?

Save the durations you calculated using *|diff|* in an additional column so that the durations are correct for every row in your...

30 days ago | 0

Answered

How can i sum up 56-year daily precipitation data from APHRODITE (netcdf file) into monthly?

If you organize your data in a timetable you can use retime to sum up monthly.

How can i sum up 56-year daily precipitation data from APHRODITE (netcdf file) into monthly?

If you organize your data in a timetable you can use retime to sum up monthly.

30 days ago | 0

Answered

Generate new column from cumulating another

A = (1:4)' A(:,2) = cumsum(A) gives: A = 1 2 3 4 A = 1 1 2 3 3 ...

Generate new column from cumulating another

A = (1:4)' A(:,2) = cumsum(A) gives: A = 1 2 3 4 A = 1 1 2 3 3 ...

30 days ago | 1

| accepted

Answered

mathematical expression from string input

https://de.mathworks.com/help/symbolic/str2sym.html >> fun = str2sym("(sin(sqrt(x)+a) * e^sqrt(x)) / sqrt(x)") fun = (e^...

mathematical expression from string input

https://de.mathworks.com/help/symbolic/str2sym.html >> fun = str2sym("(sin(sqrt(x)+a) * e^sqrt(x)) / sqrt(x)") fun = (e^...

1 month ago | 1

| accepted

Answered

Solve formal equation and get the solution with these variables

syms i1 i2 ib v1 v2 hie hre hfe hoe hfb eqns(1) = i1==-ib-hfe*ib+(v1-v2)*hoe; eqns(2) = i2==hfe*ib+(v2-v1)*hoe %ib==-v1/hie...

Solve formal equation and get the solution with these variables

syms i1 i2 ib v1 v2 hie hre hfe hoe hfb eqns(1) = i1==-ib-hfe*ib+(v1-v2)*hoe; eqns(2) = i2==hfe*ib+(v2-v1)*hoe %ib==-v1/hie...

1 month ago | 1

| accepted

Answered

Importing a table with unknown number of rows

I dont think it is needed to specify this, using readtable function. I never used this option to import a .csv-file as table in ...

Importing a table with unknown number of rows

I dont think it is needed to specify this, using readtable function. I never used this option to import a .csv-file as table in ...

1 month ago | 0

| accepted

Answered

Problem with solution seemingly simple linear system of equations [0x1 sym]

rewriting the system to matrix shows that this system has no solution, due to inconsistence: d=32; %mm - Srednica tÅ‚oka p1=0.5...

Problem with solution seemingly simple linear system of equations [0x1 sym]

rewriting the system to matrix shows that this system has no solution, due to inconsistence: d=32; %mm - Srednica tÅ‚oka p1=0.5...

1 month ago | 0

| accepted

Answered

Integration using trapz method

1 missing bracket and you missed to define dx: d = 30; E0=8.85e-12; c=.1; dx = 0.1; a = 0; b = 1; x = a:dx:b; N = lengt...

Integration using trapz method

1 missing bracket and you missed to define dx: d = 30; E0=8.85e-12; c=.1; dx = 0.1; a = 0; b = 1; x = a:dx:b; N = lengt...

1 month ago | 0

| accepted

Answered

Meshgrid fo variables in complex equation

You might want to try fimplicit3: syms f(x,y,z) f(x, y, z)=2*x+3*y+4*z==0 fimplicit3(f) or an even more complex example: f(...

Meshgrid fo variables in complex equation

You might want to try fimplicit3: syms f(x,y,z) f(x, y, z)=2*x+3*y+4*z==0 fimplicit3(f) or an even more complex example: f(...

1 month ago | 1

| accepted

Answered

How to split an cell array of two numbers into two columns

YouWant = [m5{:}]'

How to split an cell array of two numbers into two columns

YouWant = [m5{:}]'

1 month ago | 0

| accepted

Answered

How to calculate matrix M*T=T

syms T2 T3 M = [1., 0, 0, 0;... 0.5, 0, 0.5, 0;... 0, 0.5, 0, 0.5;... 0 0 0 1.] T = [500; T2; T3; 300] B =...

How to calculate matrix M*T=T

syms T2 T3 M = [1., 0, 0, 0;... 0.5, 0, 0.5, 0;... 0, 0.5, 0, 0.5;... 0 0 0 1.] T = [500; T2; T3; 300] B =...

1 month ago | 0

| accepted

Answered

how would i change an undirected network into a directed network on matlab?

here is a small example: A = [0 0 1; 0 0 1; 1 1 0] ug = graph(A) B = zeros(size(A,1)) B = B + triu(A) dg = digraph(B) ...

how would i change an undirected network into a directed network on matlab?

here is a small example: A = [0 0 1; 0 0 1; 1 1 0] ug = graph(A) B = zeros(size(A,1)) B = B + triu(A) dg = digraph(B) ...

1 month ago | 1

Answered

Simplify a symbolic expression

syms s T=21.0325 L=3.5890 X=(0.6*T)*((s+(1/L))^2)/s vpa(expand(X),10)

Simplify a symbolic expression

syms s T=21.0325 L=3.5890 X=(0.6*T)*((s+(1/L))^2)/s vpa(expand(X),10)

1 month ago | 0

| accepted

Answered

which optimization method should I use?

Following your statements surrogateopt appears to be the correct choice.

which optimization method should I use?

Following your statements surrogateopt appears to be the correct choice.

2 months ago | 0

| accepted

Answered

Invalid array indexing. column 19.help

epsilon(i)(xi2(i)((1-epsilon(i)) is not allowed in Matlab, do you mean?: epsilon(i)*(xi2(i)*((1-epsilon(i))

Invalid array indexing. column 19.help

epsilon(i)(xi2(i)((1-epsilon(i)) is not allowed in Matlab, do you mean?: epsilon(i)*(xi2(i)*((1-epsilon(i))

2 months ago | 1

| accepted

Answered

Matlab Code (Reinforcement Learning in Finance by Alex Roumi, MathWorks)

The code has never been published. Usually the code used in webinars is published at file exchange, but this was a presentation ...

Matlab Code (Reinforcement Learning in Finance by Alex Roumi, MathWorks)

The code has never been published. Usually the code used in webinars is published at file exchange, but this was a presentation ...

2 months ago | 0

| accepted

Answered

Error using horzcat:: Dimensions of array being concentenated are not consistent

There are 2 times the same values at different indices. To get only the first occourence: S=[.2046e17 .1381e17 .9249e17;.1679e1...

Error using horzcat:: Dimensions of array being concentenated are not consistent

There are 2 times the same values at different indices. To get only the first occourence: S=[.2046e17 .1381e17 .9249e17;.1679e1...

2 months ago | 0

Answered

How do i create a "Cut" at origin?

A = 5; M = 0.8; w = 1.2; fi = 30; t2 = 20; firad = fi*pi/180; t = linspace(0,t2,1000); y = M + A*sin(w.*t + firad); ...

How do i create a "Cut" at origin?

A = 5; M = 0.8; w = 1.2; fi = 30; t2 = 20; firad = fi*pi/180; t = linspace(0,t2,1000); y = M + A*sin(w.*t + firad); ...

2 months ago | 0

| accepted

Answered

Creating matrix with diag command

This is how a normal Matlab user would so this z = diag(1:10) z = 1 0 0 0 0 0 0 0 0 ...

Creating matrix with diag command

This is how a normal Matlab user would so this z = diag(1:10) z = 1 0 0 0 0 0 0 0 0 ...

2 months ago | 0

| accepted

Answered

not enough input data

Note that i used the same function for step2 like step1 to make it work - replace step2 with the correct function. Also i assume...

not enough input data

Note that i used the same function for step2 like step1 to make it work - replace step2 with the correct function. Also i assume...

2 months ago | 0

| accepted