I have a program which I copied from a textbook, and which times the difference in program execution runtime when calculating the same thing with uninitialized, initialized array and vectors.
However, although the program runs somewhat as expected, if running several times every once in a while it will give out a crazy result. See belo...
I'm supposed to take two sentences each time and compute if they are similar. By similar I mean, both syntactically and semantically.
INPUT1: Obama signs the law.
A new law is signed by Obama.
INPUT2:
A Bus is stopped here.
A vehicle stops here.
INPUT3: Fire in NY.
NY is burnt down.
...
Hey,
If I use the load function by matlab I normally end up doing something like this:
temp = load('filename.mat');
realData = temp.VarName;
clear temp
or
realData = load('filename.mat');
realData = realData.VarName;
is any of this methods superiour to the other, especially in terms of memory usage? Or is there a more direct app...
I wrote a k-Means clustering algorithm in MATLAB, and I thought I'd try it against MATLABs built in kmeans(X,k).
However, for the very easy four cluster setup (see picture), MATLAB kMeans does not always converge to the optimum solution (left) but to (right).
The one I wrote does not always do that either, but should not the built-in f...
Hi.
I have following equation:
f(N): N = ((1+lam)^3 )/ ((1-lam)*(1+lam^2));
I need to create a function that finds lam for specified N.
Right now I'm doing it using simple loop:
lam = 0.9999;
n = f(lam);
pow = 0;
delta = 0.1;
while(abs(N - n)) > 0.1 & pow < 10000)
lam = lam - 0.001;
n = f(lam)
pow = pow+1;
end
How c...
Hi there,
My head gets stucked finding an algorithm for my problem.
Assume I have N Numbers (lets say 4) and I want have ALL X-Partitions (X = N/2)
Example:
2-Partitions of {1,2,3,4} are: (1,2) (1,3) (1,4) (2,3) (2,4) (3,4) [Simply: all combinations]
I don't have a clue how to generate these combinations. If someone of you have an i...
Hello I'm trying to control FastHenry2 via Windows automation with Matlab.
I'm new to that topic. If I understood everything right I have to open it:
ax=actxserver('FastHenry2.Document');
and than run the function I want with the handle?
ax.Run('coils1.inp')
but that doesn't work. Matlab can't find Run and uses run instead, which i...
How is the sort() working in matlab?
Code in pure matlab:
q is an array:
q = -0.2461 2.9531 -15.8867 49.8750 -99.1172 125.8438 -99.1172
49.8750 -15.8867 2.9531 -0.2461
After q = sort(roots(q)), I got:
q = 0.3525
0.3371 - 0.1564i
0.3371 + 0.1564i
0.2694 - 0.3547i
0.2694 + 0.3547i
...
Is there a matlab function to initiate a program at a preset time?
for example, I want to run the script runmyfile.m at 14h00 ?
...
I had like to optimize the following Matlab code :
x = linspace(-5,5,100);
y = linspace(-5,5,100);
z = linspace(-5,5,100);
[xp,yp,zp] = meshgrid(x,y,z);
norm = sqrt(xp.^2+yp.^2+zp.^2);
I improved it a little using realsqrt :
norm_0 = sqrt(xp.^2+yp.^2+zp.^2) 10.106 s 37.0%
norm_1 = realsqrt(xp.^2+yp.^2+zp.^2) 1...
Hi, I opened a c file in Turbo C, the beginning of this c file looks like this:
#include <math.h>
#include <stdio.h>
#include "mex.h"
#include "matrix.h"
It uses some of the matlab structures and do something in c
I checked the directory and am sure that they are right. but when I tried to compile it, some errors here (I just copy s...
Hi there,
right now I'm following an Matlab tutorial http://www.mathworks.com/help/techdoc/creating_guis/brpat2g.html .
The Problem is my Matlab Version r2006a the GUIDE GUI Builder doesn't have an table tool. Does any one know how to figure out in which version it was introduced?
so long
eactor
...
I have been working on extracting the peak values from a graph (see previous question) which looks like this:
but I have noticed that for some of the xcorr graphs I have been working on the values do not turn out as expected and they normally turn out looking more like this:
and this:
Instead of trying to pick the peak values li...
I want to use a words like, let's say, 'A', 'B' and 'C' on X-axis to show their corresponding properties on Y-axis. How can I write these strings on X-axis instead of numerical data?
...
I have a rather complicated function the I would like to write as an anonymous function.
It looks something like this:
function Answer = MatlabFunction(x)
a=4*x;
b=sin(a);
c=cos(b);
Answer = c;
I don't know how to put this into an anonymous function however. Is there a way to do this without writing it as several cascading functions...
I want to make a slight change to a MATLAB function at each step in a for loop. My function is too complicated to write as anonymous. Is there any way to change an m-file function at each step?
Additional Info:
My function is an equations with 8 inputs and infinitely many solutions. I want set 7 of the inputs and then use fsolve to f...
I have an m-file function with 4 outputs. I would like to define an anonymous function that has the same inputs, but only produces 2 of the four outputs. Is this possible?
...
Assume that the data X has size 1000 *1000. X is displayed using the command:
imagesc(X);
and all the rows are labeld using:
set(gca, 'YTickLabel', somelabels);
Although the data X are properly polotted and the Ytick labels are also shown, the labels are highly overlapped because of the large number of rows. Is there any way to sol...
I'm trying to find the maximum value of a certain column in a matrix. I want to find both the maximum value and the index of the row in which it is. How can I do this?
...
Hello,
I write a script in matlab, which produces figures out a set of data.
The figures are supposed to rather similar with respect to formating, and each of them is ought to display a set of data ( it is graph embedded in a 3d-domain ). Each of these figures is ought furthermore to display a set of particles within that 3d-domain.
S...