Answered

Speeding up a for loop

If you don't mind having 3 dimensional arrays something like this can be used rng(42) S1 = 5994; S2 = 88; S3 = 8; A = 100*r...

Speeding up a for loop

If you don't mind having 3 dimensional arrays something like this can be used rng(42) S1 = 5994; S2 = 88; S3 = 8; A = 100*r...

6 days ago | 0

| accepted

Answered

Rotate vector in row

This may solve your problem: rng(42) n= [1,19,15,18,21,10,16,2,7,3,17,6,1; 1,14,20,8,4,13,9,5,1,0,0,0,0; 1...

Rotate vector in row

This may solve your problem: rng(42) n= [1,19,15,18,21,10,16,2,7,3,17,6,1; 1,14,20,8,4,13,9,5,1,0,0,0,0; 1...

6 days ago | 0

| accepted

Answered

How can use parallel programming in the below code?

You can indeed try to do the code in parallel with a parfor loop in the "i" loop and some tweak in the eta2 variable bound like ...

How can use parallel programming in the below code?

You can indeed try to do the code in parallel with a parfor loop in the "i" loop and some tweak in the eta2 variable bound like ...

6 days ago | 0

Answered

How to select different data points in different images in a loop?

I don't think a zeropad approach would be optimal, the main problem is that your vector can increase size every time as the same...

How to select different data points in different images in a loop?

I don't think a zeropad approach would be optimal, the main problem is that your vector can increase size every time as the same...

6 days ago | 0

Answered

LONGEST PATH BY PRODUCT

You can take the log of your inverse matrix and use the log property: Which basically says that maximizing/minimizing the sum...

LONGEST PATH BY PRODUCT

You can take the log of your inverse matrix and use the log property: Which basically says that maximizing/minimizing the sum...

6 days ago | 0

Answered

Having problem to change the value of extra parameters at each time step passed in ODE45 Solver

You can do it accurately only by doing partial integrations (make a loop in ode45 for the time steps) and changing the variable ...

Having problem to change the value of extra parameters at each time step passed in ODE45 Solver

You can do it accurately only by doing partial integrations (make a loop in ode45 for the time steps) and changing the variable ...

6 days ago | 0

| accepted

Answered

How to calculte and plot this equation in matlab ,when T=(0-3000k)

T = 0:3000; X = @(T) 6.626e-34./sqrt(2*pi*9.11e-31*1.38e-23*T); figure,plot(X(T),T)

How to calculte and plot this equation in matlab ,when T=(0-3000k)

T = 0:3000; X = @(T) 6.626e-34./sqrt(2*pi*9.11e-31*1.38e-23*T); figure,plot(X(T),T)

13 days ago | 0

| accepted

Answered

Legend not using correct colors

Your zeros(max_k) was a matrix, so each plot command made many plots and the legends went to the wrong place. Making it only ...

Legend not using correct colors

Your zeros(max_k) was a matrix, so each plot command made many plots and the legends went to the wrong place. Making it only ...

13 days ago | 2

| accepted

Answered

Numerically approximate the MLE by evaluating function

If you want to make sure -10 is not in the interval and still get equidistant points you could do something like this (it actual...

Numerically approximate the MLE by evaluating function

If you want to make sure -10 is not in the interval and still get equidistant points you could do something like this (it actual...

20 days ago | 0

| accepted

Answered

How to solve multivariable nonlinear optimization problem (fmincon or another optimization)

fmincon accepts a vector of variables, which means that as long as you pack all your variables in a vector x it doesn't matter i...

How to solve multivariable nonlinear optimization problem (fmincon or another optimization)

fmincon accepts a vector of variables, which means that as long as you pack all your variables in a vector x it doesn't matter i...

20 days ago | 0

Answered

Index of a Column Vector

Just use brackets for the array index A = 1:7; A([1,2,6]) ans = 1 2 6

Index of a Column Vector

Just use brackets for the array index A = 1:7; A([1,2,6]) ans = 1 2 6

20 days ago | 0

Answered

find array equal and put it in group?

This is one of the basic functionalites of the unique function, just do something like this: A = [1 0 0 0 0 0 1 0 0 1 ...

find array equal and put it in group?

This is one of the basic functionalites of the unique function, just do something like this: A = [1 0 0 0 0 0 1 0 0 1 ...

20 days ago | 1

| accepted

Answered

Create a function that interpolates matrix values

Yes, sure. Something like this should do the trick: % Your tabular function A = [1,2; 3,4]; % Your values x = 1....

Create a function that interpolates matrix values

Yes, sure. Something like this should do the trick: % Your tabular function A = [1,2; 3,4]; % Your values x = 1....

20 days ago | 0

Answered

Integrating a multivariate function (5 variables)

You first have to define what you want to plot it. This seems to be a function of w, so, for different w's you want to integrate...

Integrating a multivariate function (5 variables)

You first have to define what you want to plot it. This seems to be a function of w, so, for different w's you want to integrate...

20 days ago | 0

Answered

Image processing Sum Square Diffrence

What exactly is the problem you're having? If the idea is just o find a template in the image you can probably find better resul...

Image processing Sum Square Diffrence

What exactly is the problem you're having? If the idea is just o find a template in the image you can probably find better resul...

27 days ago | 0

| accepted

Answered

Finite explicit method for heat differential equation

You were actually pretty close, the main problem was that in the boundary condition you was exponentiating your index, not your ...

Finite explicit method for heat differential equation

You were actually pretty close, the main problem was that in the boundary condition you was exponentiating your index, not your ...

1 month ago | 1

Answered

Matrix Logical Indexing in If...else... construction

If you wanna check that a condition happens at least one time in an array you can use "any" elseif any(isinf(varargin{j})) || a...

Matrix Logical Indexing in If...else... construction

If you wanna check that a condition happens at least one time in an array you can use "any" elseif any(isinf(varargin{j})) || a...

1 month ago | 0

| accepted

Answered

coxphfit survival numerical issue

In your S0 variable for the 0.8 case the last non-zero value is 3.2114e-321, which is way lower than the maximum numerical accur...

coxphfit survival numerical issue

In your S0 variable for the 0.8 case the last non-zero value is 3.2114e-321, which is way lower than the maximum numerical accur...

1 month ago | 0

Answered

How to choose a ROI of an image and make rest transparent, then save it?

To write the image I has to be either a double normalized to 1 or a uint8 with values from 0 to 255, in your case you had double...

How to choose a ROI of an image and make rest transparent, then save it?

To write the image I has to be either a double normalized to 1 or a uint8 with values from 0 to 255, in your case you had double...

1 month ago | 0

| accepted

Answered

Python to Matlab interfacing

Matlab can easily call python functions from the command, check this link from mathworks that explain how you can call your own ...

Python to Matlab interfacing

Matlab can easily call python functions from the command, check this link from mathworks that explain how you can call your own ...

1 month ago | 0

Answered

Graphing Confidence Intervals with upper and lower bounds

You were creating a picture for every loop iteration, and the plot function can't interpolate between points if you give them on...

Graphing Confidence Intervals with upper and lower bounds

You were creating a picture for every loop iteration, and the plot function can't interpolate between points if you give them on...

1 month ago | 0

Answered

Neural Network - MLP

I'm not sure why you want to shorten the code, it is already vectorize and I don't believe it can go so much less than this. Jus...

Neural Network - MLP

I'm not sure why you want to shorten the code, it is already vectorize and I don't believe it can go so much less than this. Jus...

1 month ago | 0

Answered

How to repeat monthly data over several years?

Matlab has a function for concatenating values in different dimensions, you could solve your problem like this: A = randn(144,1...

How to repeat monthly data over several years?

Matlab has a function for concatenating values in different dimensions, you could solve your problem like this: A = randn(144,1...

1 month ago | 0

| accepted

Answered

Generate normally distributed sample from data

I need to be careful to not start any discussion about how one actually define a normal distribution, but starting from the poin...

Generate normally distributed sample from data

I need to be careful to not start any discussion about how one actually define a normal distribution, but starting from the poin...

1 month ago | 0

| accepted

Answered

Where are the bugs for this ODE finite difference problem that solve using Newton Raphson method?

I didn't check exactly your FEM implementations but one thing that I quickly noticed is that the Newton-Rapson is an iteractive ...

Where are the bugs for this ODE finite difference problem that solve using Newton Raphson method?

I didn't check exactly your FEM implementations but one thing that I quickly noticed is that the Newton-Rapson is an iteractive ...

2 months ago | 0

Answered

How do I create a loop for this expression?

Those modifications fix your code. Your fogot the actually equation in the iteration and had some variables misplaced. a=input...

How do I create a loop for this expression?

Those modifications fix your code. Your fogot the actually equation in the iteration and had some variables misplaced. a=input...

2 months ago | 0

Answered

I'm trying to make a game and need some help

I would maybe advise you to use somehting like Unity to create your game since Matlab is more to perform numerical computations....

I'm trying to make a game and need some help

I would maybe advise you to use somehting like Unity to create your game since Matlab is more to perform numerical computations....

2 months ago | 0

Answered

how to combine two image to get one image

This should do what you want: I = imread('cameraman.tif'); I2 = imresize(rgb2gray(imread('onion.png')),[size(I,1),size(I,2)])...

how to combine two image to get one image

This should do what you want: I = imread('cameraman.tif'); I2 = imresize(rgb2gray(imread('onion.png')),[size(I,1),size(I,2)])...

2 months ago | 0

Answered

fill a boundary region with white colour

You can transform the contourns in a binary image, fill it and than translate it back to your original image. Here is an example...

fill a boundary region with white colour

You can transform the contourns in a binary image, fill it and than translate it back to your original image. Here is an example...

2 months ago | 1

| accepted

Answered

how to join highlighted points by curve in 3D

For you to join those points with a radius that will gradually increase you first need to define what exactly is "gradually incr...

how to join highlighted points by curve in 3D

For you to join those points with a radius that will gradually increase you first need to define what exactly is "gradually incr...

2 months ago | 1

| accepted