Answered
Error using ode45. Must return a column vector?
1x20 is not a column vector, but a row vector. transpose it to 20x1.

7 years ago | 0

| accepted

Solved


Remove NaN ?
input -> matrix (n*m) with at least one element equal to NaN; output -> matrix(p*m), the same matrix where we deleted the enti...

7 years ago

Solved


Back to basics 21 - Matrix replicating
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, generate an output matrix that consists o...

7 years ago

Solved


Back to basics 23 - Triangular matrix
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, return a matrix with all elements above a...

7 years ago

Answered
Why I cannot define a function in live script?
Hi, you are right - it is freezed: But there is nothing wrong with this, since you can not run a function which is defined b...

7 years ago | 4

Answered
gauss elimination or inverse
Hi, use polyfit to do this. Best regards Stephan

7 years ago | 1

Answered
How to find the running time of the program if I use optimization toolbox?
Hi, maybe you are looking for timeit or for tic / toc. Best regards Stephan

7 years ago | 0

| accepted

Answered
When I integrate a constant over Tp I should get the constant but I don't?
Hi, int is a Symbolic Toolbox function. Use either double or integral for direct numeric computation. a0 = double((1/T)*int(10...

7 years ago | 0

| accepted

Answered
ODE Solver Running Very "Slowly"
Hi, it is a very bad idea what happens with B_test.m while the solver runs: In every call of the ode function by the solver B_...

7 years ago | 3

| accepted

Answered
How to assign the value for Integer variable indices in GA toolbox?
Hi, consider you have 8 variables x(1)...x(8). The following code makes x(1), x(2), x(4) and x(6) integer constrained in range ...

7 years ago | 1

| accepted

Answered
Evaluate matrix equation at multiple timesteps
Hi, try: R=[1 0.5; 0.5 1]; M0=[1;1]; u0=[1;0]; x=repmat(linspace(0,1,100),2,1); y = zeros(2,size(x,2)); f=@(x) expm(-R.*x...

7 years ago | 1

| accepted

Answered
Order of the Matlab Ode Solutions Appearing at Output?
Hi, unfortunally Matlab sometimes changes the order of outputs to an order which appears not be logical (at least for me). I do...

7 years ago | 0

| accepted

Answered
odeToVectorField: Unable to convert the initial value problem to an equivalent dynamical system.
Hi, i deleted my first answer - cause your comment brought me to a new thought - DAE: syms t v1(t) v2(t) v3(t) eq1 = v1(t) ==...

7 years ago | 0

| accepted

Answered
i have installed latest version ..... and i cannot find simscape electronics module in that and how to add that one
Hi, Simscape Powersystems and Simscape Electronics have been bundled to Simscape Electrical: https://de.mathworks.com/help/phy...

7 years ago | 0

Answered
Using summation containing function for curve fitting
Hi, you can use this script: x0 = [12 3]; x = lsqcurvefit(@(x,t)equation_fit(x,t),x0,t,S) S_calculated = equation_fit(x,t); ...

7 years ago | 2

| accepted

Answered
How to solve in MATLAB 2018b ???
Hi, the following runs for me in 2018b: clear all % State equations syms x1 x2 p1 p2 u; Dx1 = x2; Dx2 = -x2 + u; % Cost f...

7 years ago | 4

| accepted

Answered
how can I solve an error of a different number of elements in GA multiobjective optimization?
Hi, try: % Optimize with gamultiobj fitness =@levulinicAcid; nvars = 2; [x,fval] = gamultiobj(fitness, nvars, [],[],[],[],[...

7 years ago | 0

Answered
How can I plot a matrix's values greater than a value as dots
[x,y] = find(X>1) scatter(x,y,'ro','MarkerFaceColor','r') xlim([0 400]) ylim([0 400])

7 years ago | 0

Answered
It says "too many output arguments" when I try to run the function. Why?
Hi, if you change the number of output arguments of a function, make sure to that the number of output arguments in your functi...

7 years ago | 1

| accepted

Answered
How can I plot an impulse response h(t) sampled with fs?
Hi, for me your code is running (made some assumptions and a small edit at the plot): % I assume that s1...s4 are scalars and ...

7 years ago | 0

| accepted

Answered
Whys isn't this if working?
Hi, consider: >> intervalo = 0 intervalo = 0 >> quant = 0 quant = 0 Now case 1 - what you told Matla...

7 years ago | 0

| accepted

Answered
plotting a column of a timetable
Hi, the quotes tell you, that Matlab does not interpret this values as numbers but as datatype char. You can check data type f...

7 years ago | 0

| accepted

Answered
Support vector machine classifier
Hi, i recommend to use the classification learner app to do this. The advatage is, that you dont have to write code to do this ...

7 years ago | 0

| accepted

Answered
Reshaping an array of n rows in a custom way
B = [unique(A(:,1)) reshape(A(:,2)',[],3)']

7 years ago | 0

| accepted

Answered
Can you find the error in this code that aims to sum the digits of a string?
Hi, try : n = '12361927' s=num2str(sumdigits(n)) if strlength(s)==1 s=s; disp('here') else while strlength(s)~=1...

7 years ago | 0

Answered
How I can create a three dimensional succession
freq(1,1,:) = (5:0.5:15)*1e9;

7 years ago | 0

| accepted

Answered
fminunc error message multiple variables
Hi, fminunc is only able to pass the optimization variable to the objective function. Since your function needs additionally in...

7 years ago | 1

| accepted

Answered
Estimating a function in matlab using different values of parameters froma matrix/dataset
Hi, no datasets needed i think, a=-4. syms r x a fun = (2*(r - 1))/(90 - x)^r - (4*(r - 1))/(2*x + 90)^r + (a*(r - 1))/(2*(90...

7 years ago | 0

| accepted

Answered
Loading indexed .mat files using a for loop
Hi, maybe this function from FEX will help to create the needed file names: Numbered Filename Array Best regards Stephan ...

7 years ago | 0

Load more