Answered

Find centroid of curve

Something like this ought to work: [~,iEnd] = max(spline_pts(1,:)); [~,iStart] = max(spline_pts(2,:)); R1 = spline_pts(:,iS...

Find centroid of curve

Something like this ought to work: [~,iEnd] = max(spline_pts(1,:)); [~,iStart] = max(spline_pts(2,:)); R1 = spline_pts(:,iS...

ongeveer een maand ago | 0

| accepted

Answered

Generate random number between -Inf and 0.5

Since the cummulative-distribution-function of the random-number-distribution has to be one at +infinity, you need to have some ...

Generate random number between -Inf and 0.5

Since the cummulative-distribution-function of the random-number-distribution has to be one at +infinity, you need to have some ...

ongeveer een maand ago | 0

| accepted

Answered

Early exit instead of a warning in ODE113?

The brute-forciest way to do this might be to give ode113 an event that interrupts after some suitably long time, i.e. long enou...

Early exit instead of a warning in ODE113?

The brute-forciest way to do this might be to give ode113 an event that interrupts after some suitably long time, i.e. long enou...

ongeveer een maand ago | 0

| accepted

Answered

Efficient ODE with function handles

If the function-handle-argument is too costly and you still want "some general flexibility" you might try to simply extend the O...

Efficient ODE with function handles

If the function-handle-argument is too costly and you still want "some general flexibility" you might try to simply extend the O...

ongeveer 2 maanden ago | 1

Answered

How to specify the color of this contourf plot?

Maybe you can avoid the problem by using fill or patch by extracting the coordinates of the perimeters of the landmask? Somethi...

How to specify the color of this contourf plot?

Maybe you can avoid the problem by using fill or patch by extracting the coordinates of the perimeters of the landmask? Somethi...

ongeveer 2 maanden ago | 0

| accepted

Answered

Multidimensional lookup table using griddedInterpolant

If you calculate all the combinations of points you dont need to go over the allcomb way, you could just as well run ndgrid at o...

Multidimensional lookup table using griddedInterpolant

If you calculate all the combinations of points you dont need to go over the allcomb way, you could just as well run ndgrid at o...

ongeveer 2 maanden ago | 0

Answered

How to solve this Projectile Motion Problem

You write down the equation of motion: taking into account as many physical effects as necessary (gravity, drag) to get a sol...

How to solve this Projectile Motion Problem

You write down the equation of motion: taking into account as many physical effects as necessary (gravity, drag) to get a sol...

ongeveer 2 maanden ago | 0

Answered

Interpolation of circular data

To my understanding simply extend the input arrays such that you have a couple of points from the first few samples added onto t...

Interpolation of circular data

To my understanding simply extend the input arrays such that you have a couple of points from the first few samples added onto t...

ongeveer 2 maanden ago | 1

| accepted

Answered

How to enter and define a function with the value of one input form the order of matrix for another input

If you need a function with a bit more complexity than "a one-liner" simply write it as an m-function file. Then you can do pret...

How to enter and define a function with the value of one input form the order of matrix for another input

If you need a function with a bit more complexity than "a one-liner" simply write it as an m-function file. Then you can do pret...

ongeveer 2 maanden ago | 0

Answered

How can I plot a straight line from a curve?

To plot a line between a point [x_i,y_i] and [0,0] simply do this: ph0p = plot([0,x_i],[0,y_i]); Then you can decorate the lin...

How can I plot a straight line from a curve?

To plot a line between a point [x_i,y_i] and [0,0] simply do this: ph0p = plot([0,x_i],[0,y_i]); Then you can decorate the lin...

ongeveer 2 maanden ago | 0

| accepted

Answered

For inbuilt solvers ODE23/DDE23, how to keep saving/output all solution values intermediately (eg: every 1 hour, save/output the solution instead of only after reaching tf)

You could request output for a selected set of points in time instead of only setting the time-span: t_all = [0:1:500]; [t_out...

For inbuilt solvers ODE23/DDE23, how to keep saving/output all solution values intermediately (eg: every 1 hour, save/output the solution instead of only after reaching tf)

You could request output for a selected set of points in time instead of only setting the time-span: t_all = [0:1:500]; [t_out...

ongeveer 2 maanden ago | 0

Answered

How can I add single vertical data cursor for all subplots ?

If you search on the file exchange you will find vertical-line FEX search-results, at a first glance at least the 4th and 6th su...

How can I add single vertical data cursor for all subplots ?

If you search on the file exchange you will find vertical-line FEX search-results, at a first glance at least the 4th and 6th su...

ongeveer 2 maanden ago | 0

Answered

How can i solve this optimization problem?

Best route might be to properly differentiate J with respect to delta_Uk and solve the normal equations and find an analytical s...

How can i solve this optimization problem?

Best route might be to properly differentiate J with respect to delta_Uk and solve the normal equations and find an analytical s...

ongeveer 2 maanden ago | 2

| accepted

Answered

Solving system of ODE's contains complex equations

The way it looks to me you have a problem something like this: One problem is that the B-matrix you've given is singular whic...

Solving system of ODE's contains complex equations

The way it looks to me you have a problem something like this: One problem is that the B-matrix you've given is singular whic...

ongeveer 2 maanden ago | 0

Answered

Scattered point clouds for pairs of arays

Have a look at the help and documentation for scatter. If you have very many points you might consider using histogram to get an...

Scattered point clouds for pairs of arays

Have a look at the help and documentation for scatter. If you have very many points you might consider using histogram to get an...

ongeveer 2 maanden ago | 1

Answered

Fit using nlinfit with uncertainties on x and y accounted for in the fit

Have a look at the total least squares tools on the file exchange: total-least-squares-with-mixed-and-or-weighted-disturbances a...

Fit using nlinfit with uncertainties on x and y accounted for in the fit

Have a look at the total least squares tools on the file exchange: total-least-squares-with-mixed-and-or-weighted-disturbances a...

ongeveer 2 maanden ago | 1

Answered

Best Descriptor for goodness of fit

The best descriptor for goodness of fit is some measure of the divergence between the distribution of residuals of your fit and ...

Best Descriptor for goodness of fit

The best descriptor for goodness of fit is some measure of the divergence between the distribution of residuals of your fit and ...

ongeveer 2 maanden ago | 0

| accepted

Answered

How to plot a contour diagram?

You should be able to do that with pcolor-in-polar-coordinates. Perhaps you might need to lightly modify the function to exactly...

How to plot a contour diagram?

You should be able to do that with pcolor-in-polar-coordinates. Perhaps you might need to lightly modify the function to exactly...

ongeveer 2 maanden ago | 0

| accepted

Answered

Creating a vector from a set of coordinates

If you do: r = [x(:),y(:)]; % (:) forms column-vectors of any-dimensional array. Then you will find: p1 = r(1,:) HTH

Creating a vector from a set of coordinates

If you do: r = [x(:),y(:)]; % (:) forms column-vectors of any-dimensional array. Then you will find: p1 = r(1,:) HTH

ongeveer 2 maanden ago | 0

| accepted

Answered

legend color does match with drawn lines?

When you want proper control of what is shown in legends always use the graphics-handles returned by the plotting-functions: fi...

legend color does match with drawn lines?

When you want proper control of what is shown in legends always use the graphics-handles returned by the plotting-functions: fi...

ongeveer 2 maanden ago | 0

| accepted

Answered

How to delete the last subplot?

The ha variable will be handles to the different subplot axes. To delete one subplot you simply do: idx2kill = 15; delete(ha(i...

How to delete the last subplot?

The ha variable will be handles to the different subplot axes. To delete one subplot you simply do: idx2kill = 15; delete(ha(i...

2 maanden ago | 1

| accepted

Answered

Divergence, curl and potential function of 2D vector fields

Ok, if this is only a question abut whether the vector-field is conservative then it is a physics/vector-calculus "home-work" qu...

Divergence, curl and potential function of 2D vector fields

Ok, if this is only a question abut whether the vector-field is conservative then it is a physics/vector-calculus "home-work" qu...

2 maanden ago | 0

Answered

Issues in plotting two graphs in the same plot with hold on function

In the screenshot matlab creates a new figure and makes the second plot in that figure, in the second you don't create the secon...

Issues in plotting two graphs in the same plot with hold on function

In the screenshot matlab creates a new figure and makes the second plot in that figure, in the second you don't create the secon...

2 maanden ago | 0

Answered

How to match voronoi area to it's point

The way I interpret your question each point [xroi,yroi] will be inside one Voronoi-cell (though my QD-tests leave a couple of e...

How to match voronoi area to it's point

The way I interpret your question each point [xroi,yroi] will be inside one Voronoi-cell (though my QD-tests leave a couple of e...

2 maanden ago | 0

Answered

Nested for loop not working

You seem to have two for-loops with kk as index. That is not going to work in any robust way. For clarity I've learnt that to av...

Nested for loop not working

You seem to have two for-loops with kk as index. That is not going to work in any robust way. For clarity I've learnt that to av...

2 maanden ago | 0

| accepted

Answered

Merging different color channels

Sure, they are after all nothing but 2-D arrays representing different aspects of an image. Just combine them any which way you ...

Merging different color channels

Sure, they are after all nothing but 2-D arrays representing different aspects of an image. Just combine them any which way you ...

2 maanden ago | 1

Answered

How to use scandinavian letters in text() when using latex as interpreter?

This at least displays the characters in the figure on screen (I've had varying successes printing to file): text(.25,.25,'$\te...

How to use scandinavian letters in text() when using latex as interpreter?

This at least displays the characters in the figure on screen (I've had varying successes printing to file): text(.25,.25,'$\te...

2 maanden ago | 0

| accepted

Answered

Does anyone know how to create colors?

Colours can be specified by rgb-values in a 1-by-3 array with values between zero and one. So for example: light_blue = [0.5 0....

Does anyone know how to create colors?

Colours can be specified by rgb-values in a 1-by-3 array with values between zero and one. So for example: light_blue = [0.5 0....

2 maanden ago | 0

| accepted

Answered

How can I solve this type of integration?

This seems like a natural case for a for-loop. Something like this: your_sum_of_integrals = 0; for j1 = 1:100 your_sum_of_i...

How can I solve this type of integration?

This seems like a natural case for a for-loop. Something like this: your_sum_of_integrals = 0; for j1 = 1:100 your_sum_of_i...

2 maanden ago | 0

| accepted

Answered

Create an image (pixels) circle with slices (not from the center) and paint each slice a different color

(The background image looked rather nice if you ask me...) If you want to find those wedge-shaped regions I think inpolygon woul...

Create an image (pixels) circle with slices (not from the center) and paint each slice a different color

(The background image looked rather nice if you ask me...) If you want to find those wedge-shaped regions I think inpolygon woul...

2 maanden ago | 0