Answered

how to ascribe two values to a parameter such that it will be time dependent

You can pass an extra parameter to RiceG1 function using an anonmymous function. In your driver function add % extra anonimous ...

how to ascribe two values to a parameter such that it will be time dependent

You can pass an extra parameter to RiceG1 function using an anonmymous function. In your driver function add % extra anonimous ...

ongeveer een jaar ago | 1

Answered

Can someone help me implement my Kuramoto Model with time delay please?

Your function requires additional parameters. One way to pass them is to use an anonymous function as extra layer % params N =...

Can someone help me implement my Kuramoto Model with time delay please?

Your function requires additional parameters. One way to pass them is to use an anonymous function as extra layer % params N =...

ongeveer een jaar ago | 0

| accepted

Answered

Euler's method in matlab

Any ODE solver gives the unknown function(s) as result, not its derivative. So, yes, your results are x and y. Note that in you...

Euler's method in matlab

Any ODE solver gives the unknown function(s) as result, not its derivative. So, yes, your results are x and y. Note that in you...

ongeveer een jaar ago | 0

| accepted

Answered

for loop/periodic implementation for number or arrays?

If you want to force the max and min values of your vectors, you can preprocess them x0(x0 < 1 & x0 > nx+1) = 1; If the bounda...

for loop/periodic implementation for number or arrays?

If you want to force the max and min values of your vectors, you can preprocess them x0(x0 < 1 & x0 > nx+1) = 1; If the bounda...

ongeveer een jaar ago | 1

| accepted

Answered

How to get this while cycle?

if B and C are matrices, make them vectors using : while any(abs(a_0-a) > 1e-6) || any(abs(B_0(:)-B(:)) > 1e-6) || any(abs(C_0(...

How to get this while cycle?

if B and C are matrices, make them vectors using : while any(abs(a_0-a) > 1e-6) || any(abs(B_0(:)-B(:)) > 1e-6) || any(abs(C_0(...

meer dan een jaar ago | 1

| accepted

Answered

how to find out node coordinates for a simple quad element?

It depends on your data structure: now your qeustion is rather vague. Assuming that you have the node coordinates in the Nx3 ar...

how to find out node coordinates for a simple quad element?

It depends on your data structure: now your qeustion is rather vague. Assuming that you have the node coordinates in the Nx3 ar...

meer dan een jaar ago | 1

Answered

Hwo to normalize a Matrix ?

Following the formula of the OT the normalization has to be done according to the max and min of each row. Note that the matrix ...

Hwo to normalize a Matrix ?

Following the formula of the OT the normalization has to be done according to the max and min of each row. Note that the matrix ...

meer dan een jaar ago | 2

| accepted

Answered

Solving nonlinear DE by reduction of order on matlab

There are some typos in your description of the problem. Here the correct version % your ODE - note that (y(1) and y(2) are exc...

Solving nonlinear DE by reduction of order on matlab

There are some typos in your description of the problem. Here the correct version % your ODE - note that (y(1) and y(2) are exc...

meer dan een jaar ago | 0

| accepted

Answered

creating array based in another array

Here a possible solution, where all arrays you want are in the columns of matrix a2 % number of entries in array 1 n = 5; % c...

creating array based in another array

Here a possible solution, where all arrays you want are in the columns of matrix a2 % number of entries in array 1 n = 5; % c...

meer dan een jaar ago | 0

Answered

Warning: Matrix is singular to working precision.

The matrix is singular because the first three rows are linearly dependent. For example you can obtain row 1 as I guess there...

Warning: Matrix is singular to working precision.

The matrix is singular because the first three rows are linearly dependent. For example you can obtain row 1 as I guess there...

meer dan een jaar ago | 0

Answered

how can i let all number in matrix X between 0~1?

If you want to scale your output in [0 1] you can use this X1 = (X-min(X))/sum(X-min(X)); in fact >> sum(X1) ans = ...

how can i let all number in matrix X between 0~1?

If you want to scale your output in [0 1] you can use this X1 = (X-min(X))/sum(X-min(X)); in fact >> sum(X1) ans = ...

meer dan een jaar ago | 0

| accepted

Answered

how to shift the plotting graph?

Not sure if it is what you want, but you can change the x-axis limits in this way: set(gca,'xLim',[5 20]) to show the portion ...

how to shift the plotting graph?

Not sure if it is what you want, but you can change the x-axis limits in this way: set(gca,'xLim',[5 20]) to show the portion ...

meer dan een jaar ago | 0

Question

Real time GMRES convergence and stop callback

Dear Matlab users, I usually solve large linear problems using gmres. These simulations could last for several tens of hours. T...

meer dan een jaar ago | 0 answers | 0

Answered

Population growth in 7 years

Below you can find the output of the following code % rate r = 0.0063; % years t = 7; % initial population a = 5e6; t =...

Population growth in 7 years

Below you can find the output of the following code % rate r = 0.0063; % years t = 7; % initial population a = 5e6; t =...

meer dan een jaar ago | 1

Question

Problem with Simscape variable visibility

Hi all, I have created a simulink model of a circuit using simscape electrical elements. I have also created two callbacks, Ini...

bijna 2 jaar ago | 1 answer | 0

Answered

how to find parallel of resistors

Maybe it's too late for the OP, but for the records, I usually use an anonymous function with multiple inputs % ananymous paral...

how to find parallel of resistors

Maybe it's too late for the OP, but for the records, I usually use an anonymous function with multiple inputs % ananymous paral...

ongeveer 2 jaar ago | 0

Answered

Nonlinear equation numerical solution

% params C = 1.2; D = 9420; E = -2.0; B = 0.1973; y0 =...

Nonlinear equation numerical solution

% params C = 1.2; D = 9420; E = -2.0; B = 0.1973; y0 =...

meer dan 2 jaar ago | 0

Answered

Plotting a taylor series function of x^(1/3) centred at x=1728

One option is to use the built-in taylor function in symbolic math toolbox. If you want to use your strategy, there are some is...

Plotting a taylor series function of x^(1/3) centred at x=1728

One option is to use the built-in taylor function in symbolic math toolbox. If you want to use your strategy, there are some is...

meer dan 2 jaar ago | 0

| accepted

Answered

Memory efficient alternative for meshgrid?

This is how to make the three-loop version analogous to the meshgrid version % some dummy values N = 300; x = linspace(1,10,N...

Memory efficient alternative for meshgrid?

This is how to make the three-loop version analogous to the meshgrid version % some dummy values N = 300; x = linspace(1,10,N...

meer dan 2 jaar ago | 0

Answered

Sorting Equal Elements of Matrix into Groups in Cell Array

I had the same problem to detect isolated nodes in a graph: conncomp is the matlab command that gets the job done: % create the...

Sorting Equal Elements of Matrix into Groups in Cell Array

I had the same problem to detect isolated nodes in a graph: conncomp is the matlab command that gets the job done: % create the...

meer dan 2 jaar ago | 0

| accepted

Answered

Error using / Matrix dimensions must agree...

f is a vector, as well as W. So you must use the dotted version of the division (that is ./ that performs the operation elementw...

Error using / Matrix dimensions must agree...

f is a vector, as well as W. So you must use the dotted version of the division (that is ./ that performs the operation elementw...

meer dan 2 jaar ago | 0

Question

Copy Matlab Command Window without diary

Hi everyone, I would like to add an optional function command at the end of a script that logs the command window to a file. I...

meer dan 2 jaar ago | 2 answers | 0

Answered

Is it possible to create a program on matlab that's works on android?

Sort of https://it.mathworks.com/help/supportpkg/android/run-on-target-hardware.html?s_tid=CRUX_lftnav

Is it possible to create a program on matlab that's works on android?

Sort of https://it.mathworks.com/help/supportpkg/android/run-on-target-hardware.html?s_tid=CRUX_lftnav

meer dan 2 jaar ago | 0

Answered

How to improve my code speed (for loop)

By profiling, the most computational intensive operations are x=T*(probe-ut)'; y=T*(gallery-ut)'; That calculation is inside ...

How to improve my code speed (for loop)

By profiling, the most computational intensive operations are x=T*(probe-ut)'; y=T*(gallery-ut)'; That calculation is inside ...

meer dan 2 jaar ago | 0

| accepted

Answered

How to optimize only 2 variables in an objective function with 3 variables?

In this case you can set the upper and lower bound for that specific variable to the same value. Maybe it is not efficient but i...

How to optimize only 2 variables in an objective function with 3 variables?

In this case you can set the upper and lower bound for that specific variable to the same value. Maybe it is not efficient but i...

meer dan 2 jaar ago | 0

Answered

How to optimize only 2 variables in an objective function with 3 variables?

Why don't you remove theta from your objective function definition and call different_function inside function? function object...

How to optimize only 2 variables in an objective function with 3 variables?

Why don't you remove theta from your objective function definition and call different_function inside function? function object...

meer dan 2 jaar ago | 0

| accepted

Answered

How to change a column vector into a square a matrix?

Not as elegant as it could be but it works, especially for small matrices % matrix dimension n = 3; % your entries (here du...

How to change a column vector into a square a matrix?

Not as elegant as it could be but it works, especially for small matrices % matrix dimension n = 3; % your entries (here du...

meer dan 2 jaar ago | 0

Answered

Calculate acceleration from velocity and time fron excel

acceleration = diff(data.Velocity)./diff(data.Time); Note that this vector has one entry less than the original ones, so you ma...

Calculate acceleration from velocity and time fron excel

acceleration = diff(data.Velocity)./diff(data.Time); Note that this vector has one entry less than the original ones, so you ma...

meer dan 2 jaar ago | 0

| accepted

Answered

Subscripted assignment dimension mismatch.

You can use repmat and create a char array function bigstring = string_multiplication(str,N) bigstring = repmat(str,N,1); ...

Subscripted assignment dimension mismatch.

You can use repmat and create a char array function bigstring = string_multiplication(str,N) bigstring = repmat(str,N,1); ...

meer dan 2 jaar ago | 0

Answered

Simulation errors when multiplying matrices

I start a new clean answer You don't have to use the index i inside your matrix like you are doing in your code: in that way yo...

Simulation errors when multiplying matrices

I start a new clean answer You don't have to use the index i inside your matrix like you are doing in your code: in that way yo...

meer dan 2 jaar ago | 0