Answered
Integration using function calls
Your question doesn't really make sense, because the integral/quadrature approximation, for a given N, is a single number. From...

15 years ago | 1

Answered
Conditional plotting, changing color of line based on value.
Because I'm a dork, I made a function to do this. It's now available on <http://www.mathworks.com/matlabcentral/fileexchange/30...

15 years ago | 1

Answered
Having Trouble Plotting 4D data
Here's another possibility for looking at the sparsity of the data. You said many of the values were 0, so maybe try this: ...

15 years ago | 0

Answered
Adding z-values for surf/contour plots
Is this what you're after? I'm not sure if you mean "add" the z-values literally (z1 + z2) or "add" in the sense of append to t...

15 years ago | 1

| accepted

Answered
nlinfit Options - how to set them?
doc statset |statset| is a function that will create a structure variable of options; you then pass this structure into |nl...

15 years ago | 1

| accepted

Answered
[DEPRECATED] What frustrates you about MATLAB?
The way that anything that turns char into cell arrays strips spaces when it does so. Sometimes -- often, in fact -- I want tho...

15 years ago | 1

Answered
nonlinear regression
If you have Statistics Toolbox, you can use |nlinfit|, although there's no guarantee that k will be in the interval (0,1). Make...

15 years ago | 0

| accepted

Answered
time shifting
On top of the syntax issues Walter and Jan point out... 1. Why use |switch|? You could easily use a simple |if|/|else|. But...

15 years ago | 0

Answered
Max. distance in a bidimensionnal vector
If Bruno's solution is what you want, and you have Statistics Toolbox, you can use |pdist| to calculate all the pairwise distanc...

15 years ago | 0

Answered
xls export problem
Dare I ask... When you say you set |xls_1 = 857_386.xls|, you do mean |xls_1 = '857_386.xls'|, right?

15 years ago | 0

Answered
t
This appears to be a reply to an earlier question's discussion. Can you please transfer it to the appropriate place, and delete...

15 years ago | 0

Answered
How to save the data set from the ode function files to the workspace
You should be able to use |save('filename')| within the function: <http://www.mathworks.com/help/matlab/ref/save.html save doc> ...

15 years ago | 0

Answered
How do I plot this non-linear function...
You should be getting an error on the line that defines |r2| (before you even get to the plot). As Matt Fig points out, the mul...

15 years ago | 0

Answered
Using a function with input parameters in ode45
The problem here seems to be that you're mixing up your representation of your dependent variables. The rate equation function ...

15 years ago | 0

| accepted

Answered
Plotting a function...
[x,y] = meshgrid(0:0.5:40); gam = atand(y./x); surf(x,y,gam,'linestyle','none')

15 years ago | 0

Answered
dat file
I'm going to assume that you're talking about a text data file. In that case, use |textscan|: fid = fopen('filename.dat'); ...

15 years ago | 0

Answered
matrix issue with null
If you want a 2-by-|Maxstep| table of nulls, you can do T = NaN(2,Maxstep); This way, |T| will be numeric. Otherwise, g...

15 years ago | 0

| accepted

Answered
Plotting a year by hour
If you're starting just with data and the knowledge that it was recorded hourly throughout a given year, why not just do somethi...

15 years ago | 0

Answered
matrix issue with null
Best practice is to make separate posts for separate questions. For the first question, can you explain what the desired output...

15 years ago | 0

Answered
Plotting a year by hour
So the issue is how to extract the first 8760 elements of a vector of 8761 points? That's easy enough: plot(x(1:end-1),y) ...

15 years ago | 0

Answered
Wrong with matrix dimensions
Aside: you can replace acc(1) = j(1); for h = 2:length(j) %lägger ihop pulserna från geigermätaren acc(h)= acc(h-...

15 years ago | 0

Answered
Wrong with matrix dimensions
I assume the error is at the bolded line ( |e = PH./p| ). It looks like this is due to a row vs column issue (as Walter mention...

15 years ago | 0

| accepted

Answered
How do I group boxplots by modifying the X locations?
You can cluster groups together using the 'factorgap' option. Would that do what you want? % make some fake data x = rand(...

15 years ago | 1

Answered
Is there a more efficient way to read a .txt data file into MATLAB?
BTW, Jonathan, a good practice is to ask a separate new question, because this second question might be something someone else m...

15 years ago | 1

Answered
Bullets in MATLAB GUIs
It's not great (see Walter's answer for more discussion), but this basically works: x = {'abc';'defg';'hijkl';'mn'}; y = re...

15 years ago | 1

| accepted

Answered
Is there a more efficient way to read a .txt data file into MATLAB?
If the file is tab-delimited, this will do it: fid = fopen('filename.txt'); headers = textscan(fid,'%s%s%s%s%s',1,'delimite...

15 years ago | 1

| accepted

Answered
fsolve help
OK, the formatting is a bit hideous, but I think I see the problem: you're trying to reference the loop index |i| inside the fun...

15 years ago | 0

Answered
Error - ??? Improper assignment with rectangular empty matrix - using "for"
You can also use MATLAB set functions, under certain assumptions. In particular, if you expect both A & B to have exactly the s...

15 years ago | 0

| accepted

Answered
Command for triangle
MATLAB Answers is a place you can get help from the user community on specific MATLAB questions. It is not intended as a place ...

15 years ago | 1

Answered
Plotting functions
MATLAB Answers is a place you can get help from the user community on specific MATLAB questions. It is not intended as a place ...

15 years ago | 1

Load more