Réponse apportée
Error: Function definitions are not permitted at the prompt or in scripts.
Don't try to define a function at the prompt or in a script. Put functions in their own M-files.

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
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 ./ ...

plus de 13 ans il y a | 1

| A accepté

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...

plus de 13 ans il y a | 2 réponses | 4

2

réponses

Réponse apportée
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...

plus de 13 ans il y a | 0

Réponse apportée
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.....

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 13 ans il y a | 3

Réponse apportée
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')

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
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:...

plus de 13 ans il y a | 0

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

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
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. ...

plus de 13 ans il y a | 0

Réponse apportée
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...

plus de 13 ans il y a | 0

Réponse apportée
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...

plus de 13 ans il y a | 0

| A accepté

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

plus de 13 ans il y a | 0

Réponse apportée
the code problem
Use the CONTINUE statement. k = 1; for ii = 1:10 for jj = 1:6 if(ii ==10 && jj == 3) con...

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
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)

plus de 13 ans il y a | 4

Réponse apportée
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...

plus de 13 ans il y a | 1

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

plus de 13 ans il y a | 1

| A accepté

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

plus de 13 ans il y a | 0

| A accepté

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

plus de 13 ans il y a | 0

Réponse apportée
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...

plus de 13 ans il y a | 1

| A accepté

Réponse apportée
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

plus de 13 ans il y a | 9

Réponse apportée
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...

plus de 13 ans il y a | 2

| A accepté

Réponse apportée
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...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
matlab does not simplify the expression?
syms x simplify((x^10)^(1/5),'IgnoreAnalyticConstraints',true)

plus de 13 ans il y a | 0

Réponse apportée
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...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
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.

plus de 13 ans il y a | 0

Réponse apportée
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 ...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 13 ans il y a | 0

Réponse apportée
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...

plus de 13 ans il y a | 0

| A accepté

Réponse apportée
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: ...

plus de 13 ans il y a | 0

Charger plus