Question

Integrating second order differential equation BVP error

I get the error "Warning: Explicit solution could not be found." when trying to integrate this BVP. I've attached a picture o...

environ un an ago | 1 answer | 0

Question

Custom Uniform Random Distribution

Say I have a uniform random distribution in matlab using the rand() function. How can I change the distribution for a given f...

presque 2 ans ago | 2 answers | 0

Question

Rejection sampling on uniform distribution?

How can I use matlab to perform rejection sampling on a uniform distribution using rand, to pick 20% of samples in the range 0 t...

presque 2 ans ago | 1 answer | 0

Question

Include "star dot" in plot legend.

I'm plotting three sets of data with the code if true plot(x_1,y_1,x_2,y_2,x_3,y_3) %Layered plot xlabel('X')...

presque 2 ans ago | 1 answer | 0

Question

Does matlab have a built in function to calculate the bunching factor?

I'm trying to calculate the bunching parameter from an ODE I have solved numerically.

presque 2 ans ago | 0 answers | 0

Question

Indexing problems using for loop and if statements

I'm trying to solve a large system of ODE's using ode45. I need to assign y(*negative number) = 0 in the function. This is impos...

environ 2 ans ago | 1 answer | 0

Question

Setting variable to zero with conditional statement?

I'm writing a for loop which runs through values and sometimes the element that the loop selects is outwith the vector length. ...

environ 2 ans ago | 1 answer | 0

Question

Running two loops at once

Hi. I have a problem where I need to run two index parameters at one time. For example, I need p to go from 1:21, but I al...

environ 2 ans ago | 0 answers | 0

Question

Saving Table In For Loop?

How can I save a table in a for loop with corresponding file name? I want to save it like how I am saving my figures, savefig...

plus de 2 ans ago | 1 answer | 0

Question

Creating a coordinate basis with equally spaced points?

Hi. I am trying to create a coordinate basis that has dimensions in x and y axis from 0 to 30. I am looking for a piece of co...

plus de 2 ans ago | 1 answer | 0

Question

How do I pass a variable into a function without defining it as global or in the arguement?

Hi, I'm writing a bit of code that will perform a nlinfit nine times. The code uses a function which is called each time I want ...

plus de 2 ans ago | 2 answers | 0

Question

How to create a gridded matrix with N equally spaced points?

I am trying to create a coordinate grid with equally spaced rows of N data points in the format of X and Y values. How can I ...

plus de 2 ans ago | 1 answer | 0

Question

How do I recombine matrices in this order?

I have nine matrices with equal dimensions of 40x10, how do I recombine them in the way shown in my png? Thank you

plus de 2 ans ago | 1 answer | 0

Question

Is there a way to get a completion measurement for a long nlinfit calculation?

I am running a simulation that can take multiple hours or even days. How do I create a status indicator for my calculation? I...

plus de 2 ans ago | 1 answer | 0

Question

How do I constrain a vector's value within a nonlinear fit?

I am fitting a set of data using nlinfit as magnetic dipoles and I want my fitted parameters to be only positive. How do I ma...

plus de 2 ans ago | 1 answer | 0

Question

How do I insert a variable into a graph title?

Hi, I'm writing a piece of code where I want to input arguements then plot. The length of the vector that I input changes the ti...

plus de 2 ans ago | 1 answer | 0

Question

How can I split a matrix into N different parts?

I have a 120x30 matrix of data points, how can I split the matrix into nine equal parts of 400 data chunks and store them as sep...

plus de 2 ans ago | 3 answers | 0

Question

When using parallel computing toolbox can I just replace all my "for" loops with "parfor" ?

I'm running an intensive calculation and want to minimise my computation time.

plus de 2 ans ago | 1 answer | 0

Question

How do I quiver plot magnetic field

I have the following code that will calculate the magnetic field from a stationary dipole in three dimensions: function B = B...

plus de 2 ans ago | 1 answer | 0

Question

How do I add multiple values stored in a matrix?

Hello all. I have a grid of data points that range from 1:30 on the x axis in steps of 1, and .25:30 on the y axis in steps o...

plus de 2 ans ago | 1 answer | 0