Answered
How to calculate a line-of-best-fit equation (y=mx+b) from a simple x-y dataset, and then to use this equation to calculate r-square?
Approach 1: what Sean said. (Note |corrcoef| gives the correlation coefficient r, not the coefficient of determination r^2) ...

14 years ago | 4

Answered
Plot Stress Contours
What are the dimensions of your variables? It sounds like maybe you have vector data? That is, Z, r, and sigma are all n-by-1....

14 years ago | 0

Answered
Extracting the value of a slider
Your slider has a |callback| property that defines the function that will be called when the slider is moved. It's *inside that...

14 years ago | 0

Answered
Event function with odesolver error
Ah. I think I have an idea now. Check the error message trace. I'm guessing the error actually occurs within |Schrodinger|. ...

14 years ago | 1

| accepted

Answered
Help with basic MATLAB syntax
Just for Sean: function doodle hf = figure; ha = axes('units','normalized','position',[0,0,1,1],... 'X...

14 years ago | 3

Answered
Is it contourplot or Isosurface?
That's a |contour| plot. But if you have vector data, you may need to go through |TriScatteredInterp| and |meshgrid| first.

14 years ago | 1

Answered
make replacements in an array
You can't have a matrix of strings 'yes' and 'no', like you've shown. You can have logicals (true/false), but they will display...

14 years ago | 0

Answered
Double Prime
If it's just a matter of spacing, you could always remove some space between the primes: xlabel('$G^{\prime\!\prime}$','Int...

14 years ago | 1

Answered
mouse button click
The figure has a property |'SelectionType'|. This will have the value |'normal'| for a left-click, and |'alt'| for a right-clic...

14 years ago | 3

| accepted

Answered
Simulation of charged particle in matlab
Without knowing the math behind what you're trying to simulate, I don't know if it's a problem in the way you've coded up the eq...

14 years ago | 0

Answered
How to skip the first line of a text file when reading it?
Given how simple your file contents are, I'd use |dlmread|: M = dlmread('filename.txt', ' ', 2, 0) The last two arguments te...

14 years ago | 10

Answered
Multiple initial conditions differential equations
There's no immediate way to do this (AFAIK). Some possible workarounds would be to make a larger system of equations (ie just s...

14 years ago | 0

| accepted

Answered
axes
I'm guessing you're getting the Code Analyzer warning "Calling AXES(h) without an output in a loop can be very slow. Include 'h'...

14 years ago | 1

| accepted

Answered
Maximization problem
If I'm interpreting correctly, your v (aka S^2) is recursively defined. So presumably you have some way to determine u(0) and S...

14 years ago | 2

| accepted

Answered
[DISCONTINUED] Wish-list for MATLAB Answer sections.
Some way to prevent questions being deleted without a good reason! I'm getting *really* annoyed with people whose response to...

14 years ago | 4

Answered
Contour plot
Massive hack that works in this case (not sure how generalizable it will be to whatever your application is): a(a==0) = NaN...

14 years ago | 0

Answered
How to create a mean bar for individual groups?
Can you clarify what you mean by "x-axis is has two points - smoker and non-smoker". For a scatter plot you need equal-sized x ...

14 years ago | 0

Answered
Finding text - Can't locate where specific text is...
I don't know what you're planning to do with this data, but it seems like some of the data types available in Statistics Toolbox...

14 years ago | 0

Answered
Best way(s) to master MATLAB?
# What everyone else said. (Especially training & tutorials. Disclaimer: I'm not *entirely* impartial!) # Read blogs like <ht...

14 years ago | 4

Answered
kmeans() in MATLAB
As I understand your question, you have a predetermined group numbering and you'd like |kmeans| to adhere to that. |kmeans| use...

14 years ago | 0

Answered
Why do you come to "MATLAB Answers"?
why(416) why(9816) Or, failing that, why(22) The first two are actually fairly accurate! In many ways, I gues...

14 years ago | 0

Answered
Subtract combinations of variables in a vector
If you have Statistics Toolbox, here's a neat trick (I think this is what you're asking for): % make a vector of numbers ve...

14 years ago | 0

| accepted

Answered
Control structures
|iskeyword| |doc|

14 years ago | 1

| accepted

Answered
Simple Solver-type function
If you have Optimization Toolbox, you can use |fsolve|. Rewrite the three equations in the form F(x) = 0, where x is a vector o...

14 years ago | 1

| accepted

Answered
Ginput in a GUI
Can't find the answer where I shared this before, so I'll just copy-n-paste. This is code that works around the limitations of ...

14 years ago | 1

Answered
ode45 - solving 2nd Order ODE IVP problem
Nothing's wrong, except your interpretation of the output. The columns of |output| correspond to y and y' (v), not v and v'. T...

14 years ago | 1

Answered
How to suppress messages from function lsqcurvefit?
Have you tried setting the |'Display'| option? opts = optimset('Display','off'); ... = lsqcurvefit(...,opts);

14 years ago | 6

| accepted

Answered
label individual points in boxplot
You should be able to use |gname|. Depending on how your data is organized, you might need to |repmat| the labels. For example...

15 years ago | 0

Answered
Contributors metainfo: reputation and more
Fittingly, time to congratulate the author of this thread. 600 rep for Oleg!

15 years ago | 0

Answered
For new matlab/simulink users, do you know about the (interactive) video tutorials?!
Just wanted to mention that a new tutorial was added recently: <http://www.mathworks.com/academia/student_center/tutorials/compu...

15 years ago | 1

Load more