Answered

PULL OUT A SPECIFIC WORD FROM A LONG STRING

You might want to start reading here: https://de.mathworks.com/help/matlab/matlab_prog/searching-and-replacing.html

PULL OUT A SPECIFIC WORD FROM A LONG STRING

You might want to start reading here: https://de.mathworks.com/help/matlab/matlab_prog/searching-and-replacing.html

3 months ago | 1

| accepted

Answered

How do I create a for loop to extract data from table?

No loop is needed: A = unstack(ReactionTime,'RESPONSE_TIME_ehmi','videostring') since you have invalid names for you video fil...

How do I create a for loop to extract data from table?

No loop is needed: A = unstack(ReactionTime,'RESPONSE_TIME_ehmi','videostring') since you have invalid names for you video fil...

3 months ago | 0

| accepted

Answered

complement of an image

I = fliplr(imread('cameraman.tif')); I1 = triu((I),1); I2 = tril(imcomplement(I)); I_res = fliplr(I1+I2); imshow(I_res) B...

complement of an image

I = fliplr(imread('cameraman.tif')); I1 = triu((I),1); I2 = tril(imcomplement(I)); I_res = fliplr(I1+I2); imshow(I_res) B...

3 months ago | 1

| accepted

Answered

Trapz gives "Second and third argument must either be variables or a variable and a nonnegative integer specifying the number of differentiations."

syms x f_scalar = @(x) 5*x^2+3*x-4; g_scalar = @(x) -4*x^2+6*x+5; f = @(vec) arrayfun(f_scalar,vec); g = @(vec) arrayfun(g_sca...

Trapz gives "Second and third argument must either be variables or a variable and a nonnegative integer specifying the number of differentiations."

syms x f_scalar = @(x) 5*x^2+3*x-4; g_scalar = @(x) -4*x^2+6*x+5; f = @(vec) arrayfun(f_scalar,vec); g = @(vec) arrayfun(g_sca...

3 months ago | 0

| accepted

Answered

Problem with input of ode113

I_1= pi^2; I_2= -2*pi^2; params.tau= 10; g= 0; V_1= -65; V_2= -65; state= [V_1;V_2]; I= [I_1;I_2]; options = odeset('ab...

Problem with input of ode113

I_1= pi^2; I_2= -2*pi^2; params.tau= 10; g= 0; V_1= -65; V_2= -65; state= [V_1;V_2]; I= [I_1;I_2]; options = odeset('ab...

3 months ago | 0

| accepted

Answered

How to define discrete variables in GA (genetic algorithm)

https://de.mathworks.com/matlabcentral/answers/401059-setup-discrete-values-for-decision-variables-in-optimization-problems

How to define discrete variables in GA (genetic algorithm)

https://de.mathworks.com/matlabcentral/answers/401059-setup-discrete-values-for-decision-variables-in-optimization-problems

3 months ago | 0

Answered

Surrogate search with integer parameters

|*intcon*| was introduced to surrogateopt in R2019b. <https://de.mathworks.com/help/gads/release-notes.html>

Surrogate search with integer parameters

|*intcon*| was introduced to surrogateopt in R2019b. <https://de.mathworks.com/help/gads/release-notes.html>

3 months ago | 0

| accepted

Answered

Accessing value in a cell

Edited because of the comments: a = {'1,65,4,5'} b = str2num(a{:}) b(2)

Accessing value in a cell

Edited because of the comments: a = {'1,65,4,5'} b = str2num(a{:}) b(2)

3 months ago | 1

| accepted

Answered

Passing parameters in boundary value problem using BVP4C

See here: <https://de.mathworks.com/help/optim/ug/passing-extra-parameters.html |*passing extra parameters*|>. I suggest to eith...

Passing parameters in boundary value problem using BVP4C

See here: <https://de.mathworks.com/help/optim/ug/passing-extra-parameters.html |*passing extra parameters*|>. I suggest to eith...

3 months ago | 0

Answered

How to extract frames from a .mp4 video?

outputFolder1=('video'); v1=VideoReader('Clock.mp4'); vid1Frames=read(v1); for frame=1:size(vid1Frames,4) outputBaseFileNa...

How to extract frames from a .mp4 video?

outputFolder1=('video'); v1=VideoReader('Clock.mp4'); vid1Frames=read(v1); for frame=1:size(vid1Frames,4) outputBaseFileNa...

3 months ago | 0

Answered

Plot pixels from 2D boolean array

% your array A = randi(2,101)-1; % the result; R=255*ones(101); G=255*(-A+1); B=255*(-A+1); res = cat(3,R,G,B); ...

Plot pixels from 2D boolean array

% your array A = randi(2,101)-1; % the result; R=255*ones(101); G=255*(-A+1); B=255*(-A+1); res = cat(3,R,G,B); ...

3 months ago | 0

| accepted

Answered

Return a value from a table

Quarter = {'Q12019'; 'Q22019'; 'Q32019'; 'Q42019'; 'Q12020'; 'Q22020'; 'Q32020'; 'Q42020'}; QuarterStartDate = ['2019-01-01'; '...

Return a value from a table

Quarter = {'Q12019'; 'Q22019'; 'Q32019'; 'Q42019'; 'Q12020'; 'Q22020'; 'Q32020'; 'Q42020'}; QuarterStartDate = ['2019-01-01'; '...

3 months ago | 1

| accepted

Answered

Inserting vertical and horizontal line in bodeplot

xline and yline should work for this purpose. Both functions were introduced with R2018b. If you use an earlier release, just de...

Inserting vertical and horizontal line in bodeplot

xline and yline should work for this purpose. Both functions were introduced with R2018b. If you use an earlier release, just de...

3 months ago | 1

| accepted

Answered

Solving EOM coupled equations using ode45

syms x(t) y(t) eq(1)=diff(y,t,2)==(3/2)*(9.81*sin(y)-diff(x,t,2)*cos(y)); eq(2)=11*diff(x,t,2)+(1/2)*cos(y)*diff(y,t,2)-(1/2...

Solving EOM coupled equations using ode45

syms x(t) y(t) eq(1)=diff(y,t,2)==(3/2)*(9.81*sin(y)-diff(x,t,2)*cos(y)); eq(2)=11*diff(x,t,2)+(1/2)*cos(y)*diff(y,t,2)-(1/2...

3 months ago | 1

| accepted

Answered

Array indices must be positive integers or logical values. Error in (line 8) mr(t)=mi-((mi-mf)*(t./tb));

I doubt you want t to have only one point. Also no for loop is needed: mi=2290000; mf=130000; tb=165; t=linspace(6.5,165...

Array indices must be positive integers or logical values. Error in (line 8) mr(t)=mi-((mi-mf)*(t./tb));

I doubt you want t to have only one point. Also no for loop is needed: mi=2290000; mf=130000; tb=165; t=linspace(6.5,165...

3 months ago | 1

| accepted

Answered

could anyone help me how to combine data in two columns

Res = [A B]

could anyone help me how to combine data in two columns

Res = [A B]

3 months ago | 0

| accepted

Answered

Not able to use ode45 to solve and plot solution to vdp equation

You are missing some things. Looks like a mix of numeric and symbolic calculations, which won't work. But tou have luck - exactl...

Not able to use ode45 to solve and plot solution to vdp equation

You are missing some things. Looks like a mix of numeric and symbolic calculations, which won't work. But tou have luck - exactl...

3 months ago | 0

| accepted

Answered

How to divide column vector elements in unequal parts against a condition?

Due to different lengths of your daily data you should use a cell array: A = readmatrix('New Text Document.txt'); k_min = mi...

How to divide column vector elements in unequal parts against a condition?

Due to different lengths of your daily data you should use a cell array: A = readmatrix('New Text Document.txt'); k_min = mi...

3 months ago | 1

| accepted

Answered

how to solve inequality in matlab R2016a

In 2019b this works by using an assumption: syms x real eqn = (x-1)*(x-2)*(x-3)*(x-4)> 0; S = solve(eqn, x) % Test solutio...

how to solve inequality in matlab R2016a

In 2019b this works by using an assumption: syms x real eqn = (x-1)*(x-2)*(x-3)*(x-4)> 0; S = solve(eqn, x) % Test solutio...

3 months ago | 0

| accepted

Answered

Tspan is not strictly increasing.

Since ode45 uses an automated stepwide control just define the start and the end of your tspan this way: tspan = [0 10]; This ...

Tspan is not strictly increasing.

Since ode45 uses an automated stepwide control just define the start and the end of your tspan this way: tspan = [0 10]; This ...

3 months ago | 0

| accepted

Answered

Subplot in ODE45

d = [0.20 0.30 0.50]; for ii = 1:numel(d) sol(ii)=ode45(@(t,C)b2(t,C,d(ii)),[0 2],[130 10 5]); t{:,ii}=sol(ii).x'; ...

Subplot in ODE45

d = [0.20 0.30 0.50]; for ii = 1:numel(d) sol(ii)=ode45(@(t,C)b2(t,C,d(ii)),[0 2],[130 10 5]); t{:,ii}=sol(ii).x'; ...

3 months ago | 1

| accepted

Answered

How to print greek letters like 'ยต' in fprintf to file handle?

fileID = fopen('testFile.txt','w') fprintf(fileID,['16.0', char(181), 'm']); fclose(fileID)

How to print greek letters like 'ยต' in fprintf to file handle?

fileID = fopen('testFile.txt','w') fprintf(fileID,['16.0', char(181), 'm']); fclose(fileID)

3 months ago | 0

| accepted

Answered

Differential Equation Problem using ode45

[W,Fa] = PBR_Isothermal; % plot results subplot(3,2,1) plot(W,Fa(:,1)) subplot(3,2,2) plot(W,Fa(:,2)) subplot(3,2,3) pl...

Differential Equation Problem using ode45

[W,Fa] = PBR_Isothermal; % plot results subplot(3,2,1) plot(W,Fa(:,1)) subplot(3,2,2) plot(W,Fa(:,2)) subplot(3,2,3) pl...

3 months ago | 1

| accepted

Answered

problem in optimization by MATLAB using genetic algorithm

Change myFitness.m to: function y = myFitness(x) s = x(1) z = x(3) x = x(2) y = ...YOUR EQUATION HERE end also change thi...

problem in optimization by MATLAB using genetic algorithm

Change myFitness.m to: function y = myFitness(x) s = x(1) z = x(3) x = x(2) y = ...YOUR EQUATION HERE end also change thi...

3 months ago | 0

| accepted

Answered

optimixation by genetic algorithm using MATLAB

Get rid of the square brackets - Matlab will interpret this as one input argument of a vectorized function. Therefore it throws ...

optimixation by genetic algorithm using MATLAB

Get rid of the square brackets - Matlab will interpret this as one input argument of a vectorized function. Therefore it throws ...

3 months ago | 0

| accepted

Answered

Plotting points that pass through y for x,y,z coordinates

Data=[0.345 0.343 0.341 0.339 0.337 %sample x data -0.005 -0.002 -0.00069 0.0015 0.0034 %sample y data 0.284 0....

Plotting points that pass through y for x,y,z coordinates

Data=[0.345 0.343 0.341 0.339 0.337 %sample x data -0.005 -0.002 -0.00069 0.0015 0.0034 %sample y data 0.284 0....

3 months ago | 1

| accepted

Answered

Time-dependent parameter for ODE system

use interp1 to achieve this - an example of how to do this is here.

Time-dependent parameter for ODE system

use interp1 to achieve this - an example of how to do this is here.

3 months ago | 0

| accepted

Answered

plot a mathmatical function

https://de.mathworks.com/help/matlab/ref/fplot.html

plot a mathmatical function

https://de.mathworks.com/help/matlab/ref/fplot.html

3 months ago | 0

Answered

Intelligent symbolic variable substitution

syms f(x) z(x) fun = f == x^2 + 8*x + 16; % equals (x+4)^2 transform = z == (x+4)^2; subs(fun, rhs(fun), lhs(transform))...

Intelligent symbolic variable substitution

syms f(x) z(x) fun = f == x^2 + 8*x + 16; % equals (x+4)^2 transform = z == (x+4)^2; subs(fun, rhs(fun), lhs(transform))...

3 months ago | 0

Answered

Use Splitapply to write multiple files

Here is a small example of how it could work: % some data to play with Gender = ['m' 'm' 'w' 'w' 'm' 'w']'; Age = randi(60,6,...

Use Splitapply to write multiple files

Here is a small example of how it could work: % some data to play with Gender = ['m' 'm' 'w' 'w' 'm' 'w']'; Age = randi(60,6,...

3 months ago | 0

| accepted