Knowledge means knowing where it is written...

Interested in:

- Optimization

- Mathematical Modelling

- Improvement of my programming skills

Answered

How can I solve a nonlinear model using Newton Raphson ?

One way: result = fsolve(@fun,[1 1 1]) function F = fun(x) F(1) = x(1) + x(2).^2 + cos(x(3)) - 2; F(2) = x(1) + sin(x(2)) ...

How can I solve a nonlinear model using Newton Raphson ?

One way: result = fsolve(@fun,[1 1 1]) function F = fun(x) F(1) = x(1) + x(2).^2 + cos(x(3)) - 2; F(2) = x(1) + sin(x(2)) ...

23 hours ago | 2

| accepted

Answered

How display a log space bar figure ?

% Set y-axis to log scale set(gca, 'YScale', 'log')

How display a log space bar figure ?

% Set y-axis to log scale set(gca, 'YScale', 'log')

23 hours ago | 0

| accepted

Answered

can anyone tell whre is the error ?

x=-2*pi:0.01:2*pi; y=exp(x); z=sqrt(exp(-x)); figure(3) p=plot(x,y,'r',x,z,'b'); p(1).LineWidth = 2; p(2).LineWidth ...

can anyone tell whre is the error ?

x=-2*pi:0.01:2*pi; y=exp(x); z=sqrt(exp(-x)); figure(3) p=plot(x,y,'r',x,z,'b'); p(1).LineWidth = 2; p(2).LineWidth ...

7 days ago | 0

Answered

How to replace the empty cells in a cell array by a 4-bits string?

load('Key.mat'); Key1 = Key(:); Key1 = reshape(replace(string(char(Key1{:}))," ","0000"),size(Key,1),size(Key,2)); results...

How to replace the empty cells in a cell array by a 4-bits string?

load('Key.mat'); Key1 = Key(:); Key1 = reshape(replace(string(char(Key1{:}))," ","0000"),size(Key,1),size(Key,2)); results...

8 days ago | 0

Answered

How to generate a symmetric Toeplitz matrix?

>> toeplitz([-pi 0 pi]) ans = -3.1416 0 3.1416 0 -3.1416 0 3.1416 0 -3.14...

How to generate a symmetric Toeplitz matrix?

>> toeplitz([-pi 0 pi]) ans = -3.1416 0 3.1416 0 -3.1416 0 3.1416 0 -3.14...

8 days ago | 4

| accepted

Answered

"syms", "sym", and "mupad" functions cause MATLAB to freeze

R2017b had this bug, but it was fixed in update 7 and following. Try to install the latest update for your release - see Step 2:...

"syms", "sym", and "mupad" functions cause MATLAB to freeze

R2017b had this bug, but it was fixed in update 7 and following. Try to install the latest update for your release - see Step 2:...

11 days ago | 0

Answered

How to use VPA (variable precision arithmetic) in calculating HH band via dwt on an image?

You can not do this. dwt2 accepts only double as input and outputs double. vpa works on symbolic variables and returns a symboli...

How to use VPA (variable precision arithmetic) in calculating HH band via dwt on an image?

You can not do this. dwt2 accepts only double as input and outputs double. vpa works on symbolic variables and returns a symboli...

2 months ago | 0

| accepted

Answered

String to Categorical array

x = [zeros(1,120), ones(1,240)]; res = categorical(x, [0, 1], {'Z', 'O'});

String to Categorical array

x = [zeros(1,120), ones(1,240)]; res = categorical(x, [0, 1], {'Z', 'O'});

2 months ago | 0

| accepted

Answered

Reducing 2nd order ODE into coupled ODE. Solve using Euler Method and graph.

tspan = [0 5]; % time span to integrate y0 = [3 0]; % initial conditions %Start of Euler Method syms y(t) E = diff(y,2) + ...

Reducing 2nd order ODE into coupled ODE. Solve using Euler Method and graph.

tspan = [0 5]; % time span to integrate y0 = [3 0]; % initial conditions %Start of Euler Method syms y(t) E = diff(y,2) + ...

2 months ago | 0

Answered

How to convert cell array to double?

c = {[1 2],[2 3]} s = cell2mat(c) s = unique(s)

How to convert cell array to double?

c = {[1 2],[2 3]} s = cell2mat(c) s = unique(s)

2 months ago | 0

| accepted

Answered

hi,i am getting error as not enough input arguments,while i run the below code....?? please let me know that?(the error is in second line of code)

Works fine for me, if called with *_2_* input arguments: res = trio(3,4) function x=trio(m,n) x=rand([3*m n]); ...

hi,i am getting error as not enough input arguments,while i run the below code....?? please let me know that?(the error is in second line of code)

Works fine for me, if called with *_2_* input arguments: res = trio(3,4) function x=trio(m,n) x=rand([3*m n]); ...

2 months ago | 0

Answered

How to solve coupled (differential) equations of motion using matlab?

Whta is the problem? There is an analytical solution (here assumed that vx0 and vz0 are equal to 1): syms w b g m x(t) y(t) z(t...

How to solve coupled (differential) equations of motion using matlab?

Whta is the problem? There is an analytical solution (here assumed that vx0 and vz0 are equal to 1): syms w b g m x(t) y(t) z(t...

2 months ago | 0

| accepted

Answered

Undefined operator '/' for input arguments of type 'function_handle'

b=400; %mm d=500; %mm Asv = [3000 5000 3000 5000]; %mm^2 fckv = [30 30 90 90]; %Mpa num_fckv = numel(fckv); fsolve_opt...

Undefined operator '/' for input arguments of type 'function_handle'

b=400; %mm d=500; %mm Asv = [3000 5000 3000 5000]; %mm^2 fckv = [30 30 90 90]; %Mpa num_fckv = numel(fckv); fsolve_opt...

2 months ago | 0

| accepted

Answered

Can't plot function

x = linspace(0,10); y = sqrt(1+x.^2)./sqrt(x.^4-x.^2+1); plot(x,y)

Can't plot function

x = linspace(0,10); y = sqrt(1+x.^2)./sqrt(x.^4-x.^2+1); plot(x,y)

2 months ago | 1

| accepted

Answered

Fit Powerlaw to Data

https://de.mathworks.com/help/curvefit/custom-nonlinear-models.html

Fit Powerlaw to Data

https://de.mathworks.com/help/curvefit/custom-nonlinear-models.html

2 months ago | 0

Answered

Numerical Solution for a System of Three ODEs with Different Constant for Each Time Element

Use interp1 for this. Here is an example: https://de.mathworks.com/matlabcentral/answers/487412-using-ode45-to-solve-differenti...

Numerical Solution for a System of Three ODEs with Different Constant for Each Time Element

Use interp1 for this. Here is an example: https://de.mathworks.com/matlabcentral/answers/487412-using-ode45-to-solve-differenti...

2 months ago | 0

| accepted

Answered

Text file manipulation, find specific lines, find there a string and replace the specific line with new content

There is a bunch of possibilities to manipulate strings: https://de.mathworks.com/help/matlab/ref/extractafter.html https://de...

Text file manipulation, find specific lines, find there a string and replace the specific line with new content

There is a bunch of possibilities to manipulate strings: https://de.mathworks.com/help/matlab/ref/extractafter.html https://de...

2 months ago | 0

Answered

Fitting an equation to a Sine Function with NonLinearModel.fit

"...I already tried using the "cftool" function in matlab but it did not have the equation I need...." Did you notice that yo...

Fitting an equation to a Sine Function with NonLinearModel.fit

"...I already tried using the "cftool" function in matlab but it did not have the equation I need...." Did you notice that yo...

2 months ago | 0

| accepted

Answered

How to replace last 3 digits in a floating point number by another 3 digits

format long x = -3.141592653589793; a = 287; x_new = sprintf('%.15f',x); x_new(end-2:end) = (sprintf('%d',a)); x_new = st...

How to replace last 3 digits in a floating point number by another 3 digits

format long x = -3.141592653589793; a = 287; x_new = sprintf('%.15f',x); x_new(end-2:end) = (sprintf('%d',a)); x_new = st...

2 months ago | 0

| accepted

Answered

I am trying to use ODE45, but I keep getting an error with myfcn saying I don't have enough inputs?

There are at least 4 problems in your code: 1. Split your main code and your ode function: tspan = [0 10]; f0 = [0 0]; ...

I am trying to use ODE45, but I keep getting an error with myfcn saying I don't have enough inputs?

There are at least 4 problems in your code: 1. Split your main code and your ode function: tspan = [0 10]; f0 = [0 0]; ...

2 months ago | 1

Answered

Having trouble with ODE45 and a System of Ordinary Differential Equations

For every equation you have to input an initial condition. You have 8 but only give 2 initial conditions to ode45. Also your ...

Having trouble with ODE45 and a System of Ordinary Differential Equations

For every equation you have to input an initial condition. You have 8 but only give 2 initial conditions to ode45. Also your ...

2 months ago | 0

Answered

Is there a function to turn ?x2 matrix of coordinates of vertices of a polygon into a ?x4 matrix of coordinates of line segments of that polygon?

Yes, circshift will do the job: A = [2, 4; 5, 6; 6, 6; 8,5] B = [2, 4, 5, 6; 5, 6, 6, 6; 6, 6, 8, 5; 8, 5, 2, 4] % The sol...

Is there a function to turn ?x2 matrix of coordinates of vertices of a polygon into a ?x4 matrix of coordinates of line segments of that polygon?

Yes, circshift will do the job: A = [2, 4; 5, 6; 6, 6; 8,5] B = [2, 4, 5, 6; 5, 6, 6, 6; 6, 6, 8, 5; 8, 5, 2, 4] % The sol...

2 months ago | 0

| accepted

Answered

could anyone help me to display the values in the matrix which are greater than the average value for the following code

B, C and D are not needed, if you use the inbuilt function mean: A=[3.3734 5.1245 4.3729 2.8406 6.5283 4.8144 ...

could anyone help me to display the values in the matrix which are greater than the average value for the following code

B, C and D are not needed, if you use the inbuilt function mean: A=[3.3734 5.1245 4.3729 2.8406 6.5283 4.8144 ...

2 months ago | 0

| accepted

Answered

How can calcuate the lines of code efficiently?

Yes, you can if you avoid using a loop and vectorize your code - see here: tic %%%code nx=512; ny=nx; dx=1; dy=dx; format...

How can calcuate the lines of code efficiently?

Yes, you can if you avoid using a loop and vectorize your code - see here: tic %%%code nx=512; ny=nx; dx=1; dy=dx; format...

2 months ago | 1

| accepted

Answered

how can i differentiate a constant in simulink?

You already have done everything exactly correct - Simulink also did what is correct. What is the derivative of y(t)=3 with resp...

how can i differentiate a constant in simulink?

You already have done everything exactly correct - Simulink also did what is correct. What is the derivative of y(t)=3 with resp...

2 months ago | 0

| accepted

Answered

Eigenvalues and Eigenvectors of Symbolic Matrix

syms E t H = [E -t -t -t -t 0 0 0 0;-t E 0 0 0 -t -t 0 0;-t 0 E 0 0 0 0 -t -t;... -t 0 0 E 0 -t 0 -t 0; -t 0 0 0 E 0 -t 0...

Eigenvalues and Eigenvectors of Symbolic Matrix

syms E t H = [E -t -t -t -t 0 0 0 0;-t E 0 0 0 -t -t 0 0;-t 0 E 0 0 0 0 -t -t;... -t 0 0 E 0 -t 0 -t 0; -t 0 0 0 E 0 -t 0...

2 months ago | 0

| accepted

Answered

what is wrong with my script

clear all for loop_index = 1:2 x = input('Input number to convert'); units = input('Input the units to convert from','s...

what is wrong with my script

clear all for loop_index = 1:2 x = input('Input number to convert'); units = input('Input the units to convert from','s...

2 months ago | 1

| accepted

Answered

Any trick to name a variable with decimal number?

No, it is simply not allowed in Matlab. No way, no trick: https://de.mathworks.com/help/matlab/matlab_prog/variable-names.html#...

Any trick to name a variable with decimal number?

No, it is simply not allowed in Matlab. No way, no trick: https://de.mathworks.com/help/matlab/matlab_prog/variable-names.html#...

2 months ago | 0

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

2 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...

2 months ago | 0

| accepted