Answered

If i have a random vector, e.g [2 4 3 4 3 4] how would i code a script to give how many times the max value is attained? I know the answer is obviously 3 here but what would the input be for any random vector? Many thanks in advance.

Easiest way: |nnz(u == vmin)|

If i have a random vector, e.g [2 4 3 4 3 4] how would i code a script to give how many times the max value is attained? I know the answer is obviously 3 here but what would the input be for any random vector? Many thanks in advance.

Easiest way: |nnz(u == vmin)|

meer dan 9 jaar ago | 2

Answered

How can I find the location of the minimum and maximum

Others have explained how to get the index of the max or min, but I'm wondering if you actually want to know what the matrix is ...

How can I find the location of the minimum and maximum

Others have explained how to get the index of the max or min, but I'm wondering if you actually want to know what the matrix is ...

meer dan 9 jaar ago | 0

Answered

curve fit with ode bad fit ??

Ah. This may have been partly my fault for mixing notation (lots of t and x and y all floating around). A good check is to see w...

curve fit with ode bad fit ??

Ah. This may have been partly my fault for mixing notation (lots of t and x and y all floating around). A good check is to see w...

meer dan 9 jaar ago | 0

| accepted

Answered

Wrong coloring of legend in semilogx plot

I just tried an example in R2013b and it worked fine, but then I messed with it a bit and happened to get something very similar...

Wrong coloring of legend in semilogx plot

I just tried an example in R2013b and it worked fine, but then I messed with it a bit and happened to get something very similar...

meer dan 9 jaar ago | 0

| accepted

Answered

Dynamic Variables in Loops

Yes, this has been answered before, and the answer is: <http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....

Dynamic Variables in Loops

Yes, this has been answered before, and the answer is: <http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....

meer dan 9 jaar ago | 1

| accepted

Answered

Masking and removing green pixels

At the risk of being accused of shameless self-promotion... <http://blogs.mathworks.com/steve/2014/08/12/it-aint-easy-seeing-gre...

Masking and removing green pixels

At the risk of being accused of shameless self-promotion... <http://blogs.mathworks.com/steve/2014/08/12/it-aint-easy-seeing-gre...

meer dan 9 jaar ago | 0

Answered

Need help creating Easy function

<https://matlabacademy.mathworks.com/R2014b/ MATLAB Academy> can help you learn the basics of MATLAB. Or the "Getting Started" s...

Need help creating Easy function

<https://matlabacademy.mathworks.com/R2014b/ MATLAB Academy> can help you learn the basics of MATLAB. Or the "Getting Started" s...

meer dan 9 jaar ago | 0

Answered

how can i stop while loop immediately by a push button?

Once the first |imcrop| call is complete, the |imshow| command is executed, then |data.stop| is checked. That gives you the blin...

how can i stop while loop immediately by a push button?

Once the first |imcrop| call is complete, the |imshow| command is executed, then |data.stop| is checked. That gives you the blin...

meer dan 9 jaar ago | 0

Answered

how can i stop while loop immediately by a push button?

When you say "i would like to stop it immediately by the button press", do you mean you'd like to interrupt the |imcrop| calls? ...

how can i stop while loop immediately by a push button?

When you say "i would like to stop it immediately by the button press", do you mean you'd like to interrupt the |imcrop| calls? ...

meer dan 9 jaar ago | 0

Answered

curve fit toolbox help system ODE and excel?

If I interpret your problem correctly, you have a system of ODEs with a parameter -- y' = f(t,y;c) -- and an Excel spreadsheet t...

curve fit toolbox help system ODE and excel?

If I interpret your problem correctly, you have a system of ODEs with a parameter -- y' = f(t,y;c) -- and an Excel spreadsheet t...

meer dan 9 jaar ago | 0

| accepted

Answered

How can I perform a curve fit using polyfit on an exponential decay model?

The problem is that when X is big, 3*exp(-0.5.*(X)) is very small. Because of how floating-point arithmetic works, that's OK as ...

How can I perform a curve fit using polyfit on an exponential decay model?

The problem is that when X is big, 3*exp(-0.5.*(X)) is very small. Because of how floating-point arithmetic works, that's OK as ...

meer dan 9 jaar ago | 0

Answered

So apparently my textbook is out of date

What version of MATLAB are you running? (Enter |version| at the command prompt and it will tell you, if you're not sure.) The co...

So apparently my textbook is out of date

What version of MATLAB are you running? (Enter |version| at the command prompt and it will tell you, if you're not sure.) The co...

meer dan 9 jaar ago | 0

Answered

How to move a (x,y) line plot to the z axis?

Something like this, perhaps? x = linspace(0,1)'; y1 = cos(2*pi*x); y2 = x.^2; y3 = y1.*y2; ribbon(x,[y1,y2...

How to move a (x,y) line plot to the z axis?

Something like this, perhaps? x = linspace(0,1)'; y1 = cos(2*pi*x); y2 = x.^2; y3 = y1.*y2; ribbon(x,[y1,y2...

meer dan 9 jaar ago | 0

Answered

Why this algorithm work only for 4 equations ?

Your |checkResult| function is returning something insufficiently close to zero. Given that it seems to be comparing the result ...

Why this algorithm work only for 4 equations ?

Your |checkResult| function is returning something insufficiently close to zero. Given that it seems to be comparing the result ...

meer dan 9 jaar ago | 0

Answered

How to find the border points for a set of latitude and longitude coordinates

You don't actually need Mapping TB to find boundaries. You can do it with <http://www.mathworks.com/help/matlab/ref/convhull.htm...

How to find the border points for a set of latitude and longitude coordinates

You don't actually need Mapping TB to find boundaries. You can do it with <http://www.mathworks.com/help/matlab/ref/convhull.htm...

meer dan 9 jaar ago | 0

| accepted

Answered

Help me differentiate between two codes??

Ah, yes. This curious bit of syntax. What you ended up with was |sum(x)|! Why? Well, MATLAB evaluates the first condition |a <= ...

Help me differentiate between two codes??

Ah, yes. This curious bit of syntax. What you ended up with was |sum(x)|! Why? Well, MATLAB evaluates the first condition |a <= ...

meer dan 9 jaar ago | 0

| accepted

Answered

how can i align two arrays according to their clock

If by "align the data" you mean you want both |data1| values and |data2| values at some common |time| values, then you will prob...

how can i align two arrays according to their clock

If by "align the data" you mean you want both |data1| values and |data2| values at some common |time| values, then you will prob...

meer dan 9 jaar ago | 0

| accepted

Answered

I am plotting the logistic growth model using ode45,But I am confused because I am getting oscillation while I should get a constant line so do you think there is another routine could I use it or I need to change something to get the right plot??

The oscillation you're seeing is a standard numerical artifact that comes from using an explicit RK method. (Look at the scale o...

I am plotting the logistic growth model using ode45,But I am confused because I am getting oscillation while I should get a constant line so do you think there is another routine could I use it or I need to change something to get the right plot??

The oscillation you're seeing is a standard numerical artifact that comes from using an explicit RK method. (Look at the scale o...

meer dan 9 jaar ago | 0

Answered

how to write a function in interval?

<https://matlabacademy.mathworks.com/R2014b/ MATLAB Academy> can help you learn the basics of MATLAB. Also the <http://www.mathw...

how to write a function in interval?

<https://matlabacademy.mathworks.com/R2014b/ MATLAB Academy> can help you learn the basics of MATLAB. Also the <http://www.mathw...

meer dan 9 jaar ago | 0

| accepted

Answered

why do I get "Matrix dimensions must agree" when using "<"

Given the form of the error message and your comment that it works for a given value of |i| (presumably at the command line), bu...

why do I get "Matrix dimensions must agree" when using "<"

Given the form of the error message and your comment that it works for a given value of |i| (presumably at the command line), bu...

meer dan 9 jaar ago | 0

Answered

Iterating in a dataset encompassing a structure

If I understand the problem correctly, you're getting a dataset with variables |r0|, |r1|, |foo|, |potato|, etc, each one of whi...

Iterating in a dataset encompassing a structure

If I understand the problem correctly, you're getting a dataset with variables |r0|, |r1|, |foo|, |potato|, etc, each one of whi...

meer dan 9 jaar ago | 0

| accepted

Answered

Solve two second order differential equations where initial values are known in a vector!

Are your equations correct there? It seems like the RHS should involve sqrt(x'^2 + y'^2) not x''^2 and y''^2. I'm going to assum...

Solve two second order differential equations where initial values are known in a vector!

Are your equations correct there? It seems like the RHS should involve sqrt(x'^2 + y'^2) not x''^2 and y''^2. I'm going to assum...

meer dan 9 jaar ago | 1

| accepted

Answered

Finding indices when the curve stops decreasing

If you have Signal Processing TB, have a look at the <http://www.mathworks.com/help/signal/ref/findpeaks.html |findpeaks|> funct...

Finding indices when the curve stops decreasing

If you have Signal Processing TB, have a look at the <http://www.mathworks.com/help/signal/ref/findpeaks.html |findpeaks|> funct...

meer dan 9 jaar ago | 0

Answered

How to set regexp expression for HH:MM dd.mm.yyyy format?

As an alternative suggestion, one approach is to pass the problem on to |datenum|: just pass the user's input along to |datenum|...

How to set regexp expression for HH:MM dd.mm.yyyy format?

As an alternative suggestion, one approach is to pass the problem on to |datenum|: just pass the user's input along to |datenum|...

meer dan 9 jaar ago | 0

Answered

demonstrating concept of confidence interval for the mean value?

Can you clarify your intent? It looks like you're doing 100000 experiments where you take 5 (n) random values in each experiment...

demonstrating concept of confidence interval for the mean value?

Can you clarify your intent? It looks like you're doing 100000 experiments where you take 5 (n) random values in each experiment...

meer dan 9 jaar ago | 0

Answered

Custom map coloring and legend in Matlab 2014b

I can't exactly replicate your problem because I don't have the files you're reading from, but I can get the same basic problem ...

Custom map coloring and legend in Matlab 2014b

I can't exactly replicate your problem because I don't have the files you're reading from, but I can get the same basic problem ...

meer dan 9 jaar ago | 0

Answered

Reading Excel XY Data and Interpolate

This is a pretty huge question -- it really depends what you're assuming about the data and, consequently, what you're trying to...

Reading Excel XY Data and Interpolate

This is a pretty huge question -- it really depends what you're assuming about the data and, consequently, what you're trying to...

meer dan 9 jaar ago | 0

| accepted

Answered

What does the value s do in my code??

This code is... a bit muddled. At the end of the day, the |s| is not really necessary. The problem you were having before with t...

What does the value s do in my code??

This code is... a bit muddled. At the end of the day, the |s| is not really necessary. The problem you were having before with t...

meer dan 9 jaar ago | 0

Answered

problem with overwritten data when auto saving

I'm not entirely clear on what the crux of the problem is. Are you trying to loop through the directories (nr, nr2, nr3) and wan...

problem with overwritten data when auto saving

I'm not entirely clear on what the crux of the problem is. Are you trying to loop through the directories (nr, nr2, nr3) and wan...

meer dan 9 jaar ago | 0

| accepted

Answered

I am a beginner using figures and uicontrol

Your |button_callback| function declaration line is commented out, so you literally have an |Undefined function 'button_callback...

I am a beginner using figures and uicontrol

Your |button_callback| function declaration line is commented out, so you literally have an |Undefined function 'button_callback...

ongeveer 10 jaar ago | 0