Réponse apportée
A Counter for the Frequency of Occurrence of an Element in a matrix for every iteration
Based on what you've outlined, this should work: cand_values = [1:5]; cand_values = sort(cand_values); counts = zeros(si...

presque 10 ans il y a | 0

Réponse apportée
Best way to input an unknown number of structures and options.
The issue is that the optional arguments need string names |'struct2'| |'struct3'| and it's freaking out because you're not pass...

presque 10 ans il y a | 0

| A accepté

Réponse apportée
Setting min/max limits to the function random (not rand nor randn)?
The easiest way to do this in your context is to restrict the actual PDF you're using to generate the random variable, rather th...

presque 10 ans il y a | 1

| A accepté

Réponse apportée
Find the nearest whole number and whole number+/-0.5 for a given value
You want v2 = ceil(2*v0)/2 v1 = floor(2*v0)/2 The "round to the closest value" is round(2*v_0)/2

presque 10 ans il y a | 0

Réponse apportée
Matlab find index of matched elements and replace values
I would do it this way: ta = [735965;735966;735968;735969;735971] data = [1;2;4;5;7]; act_time = [735965:735971]; a...

presque 10 ans il y a | 1

| A accepté

Réponse apportée
Can Non-linear regression be used for time series forecasting?
The short answer is yes. At this point in the example: [b,bint,resid] = regress(logts.data, X); They've returned a set o...

presque 10 ans il y a | 0

Réponse apportée
Fminsearch: more initial values than parameters
Okay, so based on what I outlined earlier, I think this is the way you should try to solve this. First of all, structure your d...

presque 10 ans il y a | 0

| A accepté

Réponse apportée
Is there a way to ask the user the hours?
You'd still need some kind of a tic-cycle to poll the current time, which is probably the guts of your clock function. I think ...

presque 10 ans il y a | 0

Réponse apportée
how to use vectorized language or any other methods to replace the following code, in order to make the computation faster
I think this should work. Replace your |for| loop with: i = [1:S] Q2(i,:,i) = Q2(i,:,i) + 1; This works on the test ca...

presque 10 ans il y a | 0

| A accepté

Réponse apportée
Minimization with discrete variable
It's a little bit unclear what your objective function is, but suppose it's something like |f(A,B)| where |A| and |B| are your d...

presque 10 ans il y a | 0

Réponse apportée
Automatic selection of best curve-fitting equation type?
I don't think there's a function which is like "best fit my data" (for a variety of reasons, but the simplest is that model sele...

presque 10 ans il y a | 0

Réponse apportée
Matlab code without for loop
I think this should work: i = image('file.jpg')%load in whatever image it is i(i == 1) = 255; i(i ~= 255) = 0;

presque 10 ans il y a | 0

| A accepté

Réponse apportée
How to integrate multivariable function numerically?
The issue is that for |triplequad| to work fun(x,y,z) must accept a vector x and scalars y and z, and return a vector of values ...

presque 10 ans il y a | 0

Réponse apportée
Where can I buy Server capacity?
I think this page provides you with a few options. The Amazon EC2 option is probably what you want since it bills hourly. ht...

presque 10 ans il y a | 0

Réponse apportée
.m file (included into .exe) to string
This ended up being the solution, although it was posted as a comment: I'm not an expert on mcc, but I don't think that's possib...

presque 10 ans il y a | 0

Réponse apportée
Warning: Inverse CDF calculation did not converge for p
It sounds like you're trying to estimate the inverse CDF function in |kdensity|. This is basically done in two steps in Matla...

presque 10 ans il y a | 0

Réponse apportée
Stop updating during a FOR loop
I think I would suggest something like this: NOC1 = Get_Control(F); %%get initial control limit fault_state = 0; for i =...

presque 10 ans il y a | 0

Réponse apportée
How to plot a disc with a given center c and radius r
You can use this answer: http://www.mathworks.com/matlabcentral/answers/98665-how-do-i-plot-a-circle-with-a-given-radius-and-...

presque 10 ans il y a | 0

| A accepté

Réponse apportée
Ι have a problem finding a minimum
It looks like the issue is that you have not passed |P| into your function. You probably want something like this instead: ...

presque 10 ans il y a | 0

Réponse apportée
I am trying to plot, at x=pi/4, the variation of the error percentage along h (h increments from 0.01 to 0.5), using the first order central difference method for function f(x)=sinx. Can't figure out what's wrong with the code. Any help please?
You need to be more careful about your brackets: z = cos(pi/4);%Exact value n=0 for h=0.01:0.01:0.5; n=n+1; ...

presque 10 ans il y a | 0

| A accepté

Réponse apportée
Retain dummy variable labels from converting categorical to dummyvar
I think you can make sense of this by following the documentation: When group is a numeric vector, dummyvar assumes that the gro...

presque 10 ans il y a | 0

Question


Patternsearch polls out of mesh points
I've encountered an issue with the patternsearch algorithm. I have a global optimization problem with an objective function tha...

presque 10 ans il y a | 2 réponses | 0

2

réponses

Réponse apportée
Shifting values in a matrix, Alignment of two matrices
I think you can do it this way: [~,ind] = ismember(B(:,2),A(:,2)) C = [A,B(ind)]; D = C(:,[1,3]); I'm not sure how ...

presque 10 ans il y a | 0

Réponse apportée
How convert matrix to original form
This loops, but it should be fast enough for your purposes, and it's easy to read, so you can probably figure out how to vectori...

presque 10 ans il y a | 0

Réponse apportée
Finding Zero of Sum of Functions by Iteration
I think the solution is to write a function: function [ sum ] = func(j,g,t,X) sum = 0; for i = 1:2*j+1 ...

presque 10 ans il y a | 0

| A accepté

Réponse apportée
Problem using lsqnonlin for minimization of a function
The problem is your function handle: myfunction=@(x)ymod(values)-yexp The value |x| is never used in your function, so t...

presque 10 ans il y a | 0

| A accepté

Réponse apportée
Integers can only be combined with integers of the same class, or scalar doubles
Try setting |data = double(data)| first.

presque 10 ans il y a | 4

| A accepté

Réponse apportée
How to fill in NaNs or <undefined> in data with the mode of each column
Select the NaNs and set them to things: A = [1 2 NaN 4 5; 1 2 3 NaN 5; 1 NaN NaN NaN 5]; m = mode(A,1); m = repmat(m,s...

presque 10 ans il y a | 0

Réponse apportée
How to obtain total sum by group
Yes. This should work; it's probably not the shortest way to do it, but it avoids looping. key = unique(groupid); tsum = ...

presque 10 ans il y a | 1

Réponse apportée
An issue related to GENETIC ALGORITHM. I am trying to solve a Large Binary Integer Linear optimization Problem using GA. GA is violating all the linear constraints.
Your problem is that you probably aren't starting with a population which meets your constraints. I can get a solution to your ...

presque 10 ans il y a | 0

| A accepté

Charger plus