Answered
Plotting velocity of a piston
You probably wanted element-by-element division rather than array division... y=29.688*(sin(0+b))./(sin(90-b)); % Note ./ ...

13 years ago | 1

| accepted

Question


Counting occurrences in order
I am wondering if anyone knows of a toolbox function that can perform this task quickly. I am not familiar with the Stats toolb...

13 years ago | 2 answers | 4

2

answers

Answered
How to find duplicate values and what are they duplicates of?
There are many ways to do it. Here is another, just for fun: X = [2;5;1;2;2;0;0]; Y = arrayfun(@(x) {x find(X==x)},uniq...

13 years ago | 0

Answered
Is there a limit to the number of characters used in a symbolic expression?
This works. str = ['y ', sprintf('+ %i',1:6000)]; syms y,y=1; subs(str) length(str) % >1300 *Fixed a typo.....

13 years ago | 0

| accepted

Answered
Use eval statement to create Matrices with variables
Why are you using EVAL in the first place? This is usually *strongly* discouraged because it is *slow*, it is *prone to bugs* a...

13 years ago | 3

Answered
replacing a string with another and vice versa
str = 'log(a(2))+a(3)*cosh(exp(bb(5)))'; % Initial string str = regexprep(str,'(bb)\((\d)\)|(a)\((\d)\)','$1_$2')

13 years ago | 0

| accepted

Answered
Finding the roots of a function gotten from using ODE45
You can do it fairly painlessly. Here is an example of finding the zeros of the solution to the Van der Pol equation with mu=2:...

13 years ago | 0

Answered
Calculating input matrix to Upper triangular matrix
A = magic(5); [m,n] = size(A) You might want to look at the TRIU function.

13 years ago | 1

| accepted

Answered
How to assign a vector data to a structure array?
When you do this: y(1:length(x)).real = deal(x{:}) MATLAB only sees one output argument, but numel(x) input arguments. ...

13 years ago | 0

Answered
I want to solve a sinus equation.
x = asin(b*sin(c)/d) Or, if you want MATLAB to do it: solve('b*sin(c)-d*sin(x)','x') You want x to be on [0 pi]? Y...

13 years ago | 0

Answered
Question about strings on a matrix.
It looks like you have a cell array of strings. The single quotes only appear when the array displays; they are not part of the...

13 years ago | 0

| accepted

Answered
excell logarithmic trend formula equivalent in matlab
x = 1:.1:10; y = 3 + 4.5 * log(x); polyfit(log(x),(y),1)

13 years ago | 0

Answered
the code problem
Use the CONTINUE statement. k = 1; for ii = 1:10 for jj = 1:6 if(ii ==10 && jj == 3) con...

13 years ago | 1

| accepted

Answered
Is there a way to obtain desired index without using 'find'?
ar=[102 243 453 768 897 243 653 23]; KEY = 1:length(ar); KEY(ar==243)

13 years ago | 4

Answered
Issues with GUI not running properly
Yes, guide GUIs need to have the initialization code in the M-file run before the figure will work as you want. It is the natur...

13 years ago | 1

Answered
detecting the existence of alphabetical elements
Perhaps best of all: str = 'adsf2342adsfwerreoj9f3f'; str2 = '23423'; flag = any(isletter(str)) flag = any(islet...

13 years ago | 1

| accepted

Answered
structure indices in one line
V = values(urlAuthsMap,KH); % KH is the key you want. See key. From the link you showed above .... ;-)

13 years ago | 0

| accepted

Answered
detecting the existence of alphabetical elements
str = 'adsf2342adsfwerreoj9f3f'; str2 = '23423'; flag = ~isempty(regexp(str,'[A-Za-z]')) flag = ~isempty(regexp(str2,...

13 years ago | 0

Answered
Gui interface code question.
What you need to remember is that you are getting a string, not a number. If you want to use it as a number, you must convert f...

13 years ago | 1

| accepted

Answered
How can I change the fontface of a text within a plot
get(gca,'fontname') % shows you what you are using. set(gca,'fontname','times') % Set it to times

13 years ago | 9

Answered
GUI Question: Is it possible to print a symbolic expression on a GUI I created?
Yes, simply use the CHAR function on the output. Then set the string property of the uicontrol to the return of the call to CHA...

13 years ago | 2

| accepted

Answered
I have no idea how to do this
You were very close, actually. A couple of things. One is, Sum holds your sum, so don't treat it like a vector by indexing int...

13 years ago | 0

| accepted

Answered
matlab does not simplify the expression?
syms x simplify((x^10)^(1/5),'IgnoreAnalyticConstraints',true)

13 years ago | 0

Answered
Writing characters to empty matrix
You may want to use cell arrays. for ii = 30:-1:1 T{ii} = sprintf('abc_x_%i',ii); end Now look: T{25} Th...

13 years ago | 0

| accepted

Answered
How do you convert an array into a square matrix?
Another: x = 1:10; % Original x = x(ones(1,length(x)),:) % indexing instead of repmatting.

13 years ago | 0

Answered
Efficient allocation of random numbers(U(0,1)) into categories
How about the <http://www.mathworks.com/help/matlab/ref/histc.html HISTC> function? Also, in your code there is no reference ...

13 years ago | 0

| accepted

Answered
Question about arrays to elements.
I think the question is a little unclear, so I will go in a circle: A = [2 3 4 5 6] % Start here A2 = str2double(sprin...

13 years ago | 0

Answered
Plot curves with different colors inside the for loop and calculation of integral with trapz
Use: hold all instead of: hold on And don't tell MATLAB to make every curve blue! You are telling MATLAB to mak...

13 years ago | 0

| accepted

Answered
issue creating loop with matrix multiplication
What are you trying to save out of the loop? If you want to save the RotAll for each element of heading, pitch and roll, do: ...

13 years ago | 0

Answered
getting error: Undefined function 'ge' for input arguments of type 'cell'.
target=0.2; vi=cellfun(@(x) x>=target,data(:,63)); data(vi,:); data3 = data(vi,:);

13 years ago | 0

| accepted

Load more