Respondida
Integration with variables as constants
If your symbolic expression is |y|, you can use yInt = int(y,r,0,Inf); *EDIT*: However, you may not get a clear answer. ...

alrededor de 14 años hace | 2

Respondida
using ode45
See <http://www.mathworks.com/support/tech-notes/1900/1901.html How Do I Obtain an Impulse Response?> for the right way to model...

alrededor de 14 años hace | 1

| aceptada

Respondida
??? Error using ==> times Matrix dimensions must agree
In the line m_bare=(Sij(nair,nSiO2)).*(Pj(nSiO2,dSiO2,donda)).* (Sij(nSiO2,nSi)); you are doing element-by-element mult...

alrededor de 14 años hace | 0

| aceptada

Respondida
Loren's blog: Best programming practice
Yes - even contributed a comment! I am very much in agreement with the first comment on Loren's blog. Clarity before speed! ...

alrededor de 14 años hace | 2

| aceptada

Respondida
Reduce dimension of a vector
I would use |find| inside |riga_save| to extract the nonzero indices. It may be more efficient, though, to have |save_rig| re...

alrededor de 14 años hace | 0

Respondida
script matlab to pdf
Apparently you have MATLAB Report Generator? If so, see <http://www.mathworks.com/help/toolbox/rptgen/ug/f8754.html#f6310 Settin...

alrededor de 14 años hace | 0

| aceptada

Respondida
random fun.
randint + 2; or randint(m,n) + 2; for a matrix of random numbers. or R = a + randint(m,n)*(b-a); to choo...

alrededor de 14 años hace | 2

Respondida
Best reason to replace structures with classes
There are a lot of potential advantages to object-oriented programming. I can hardly do them justice in a short answer. Try read...

alrededor de 14 años hace | 1

Respondida
Problem with plotting two lines on the same graph using different line types.
Your equations for |x| and |y| use matrix multiplication, resulting in a |1601 x 1601| matrix. Use element-by-element multiplica...

alrededor de 14 años hace | 1

| aceptada

Respondida
How to solve for Z in the following equation?
The key is to define a function that is zero for the desired value of |Z|: f = @(Z) Z./((1+Z.*x).*(pi+atan(Z-0.1)))-y; S...

alrededor de 14 años hace | 0

Respondida
Str2num error
If you run it with the following command str2num you will get this error. Try str2num('2') I am assuming that yo...

alrededor de 14 años hace | 1

| aceptada

Respondida
NaN when calculating average
You could use |nanmean| to ignore the NaN's while calculating means: prices = rand(20,20); n = size(prices,1); m = size(pr...

alrededor de 14 años hace | 0

Respondida
Repmat with pattern
For 1. you could use B = blkdiag(A,A); For 2, why not just use the command you gave? B=[A,zeros(2);A,A] ; For 3...

alrededor de 14 años hace | 0

Respondida
trouble with the eval function and cell
Avoid |eval| - use dynamic field names: data{ex.no,1}.(varList{i}) = varList{i}; See "Generate Field Names from Variable...

alrededor de 14 años hace | 2

Respondida
[DISCONTINUED] Wish-list for MATLAB Answer sections.
The status of questions should be updated promptly when they are answered. A search with "Unanswered" selected returns several q...

alrededor de 14 años hace | 0

Respondida
Trying to reduce error for negative x in an exponential function
Using a Taylor series to calculate |exp(x)| for negative |x| is a bad idea because rounding errors quickly destroy the accuracy....

alrededor de 14 años hace | 1

Respondida
question abt variable size array in a for loop
Use cell arrays. If I understand your problem, you are saving |num| runs, so you could use code like this: XX = cell(num,1)...

alrededor de 14 años hace | 0

Respondida
"successor" and "predecessor" functions for enumerated types
You could make a linked list with an enumerated class as one of its properties. See <http://www.mathworks.com/help/techdoc/matla...

alrededor de 14 años hace | 0

Respondida
\-operator to perform least squares fit on multiple sample-sets
If I understand your question, you are trying to estimate |y| given multiple measurements of |x|. Note that if |M| were a matrix...

alrededor de 14 años hace | 0

Respondida
Function to Vector
It is very natural for functions to output vectors in MATLAB. See <http://www.mathworks.com/help/techdoc/ref/function.html the d...

alrededor de 14 años hace | 0

Respondida
Using Optimization Toolbox to Fit a Piecewise Curve
You're getting the error because you are doing element-by-element multiplication ( |.*| ) in your objective function. That will ...

alrededor de 14 años hace | 0

Respondida
optimization
A linear function is twice differentiable - the second derivative is zero! So go ahead and use |fmincon|.

alrededor de 14 años hace | 0

| aceptada

Respondida
stdout in MATLAB using fprintf
Perhaps <http://www.mathworks.com/support/solutions/en/data/1-ACT3YN/index.html?product=ML&solution=1-ACT3YN this solution> woul...

alrededor de 14 años hace | 0

Respondida
gammaln: why no negative arguments allowed?
The functions |gamma| and |gammaln|, and their documentation, are restricted to the real numbers, but these functions can only b...

alrededor de 14 años hace | 0

Respondida
hilbert transform
See <http://www.mathworks.com/matlabcentral/answers/3134-hilbert-transform this discussion of the Hilbert transform>.

alrededor de 14 años hace | 0

| aceptada

Respondida
Problem with axes
Just make each subplot the current plot and set |zoom on|, e.g., subplot(4,2,1) zoom See also the examples in <http:/...

alrededor de 14 años hace | 0

Respondida
what is the meaning of '.' in the below equation?
What is the "meaning" of an erroneous expression? Probably the intended expression was F=(X1-1).^2+(X2-2.2).^2+1; Here |...

alrededor de 14 años hace | 0

| aceptada

Respondida
unequal vectors
tf = ismember(A,B); C = 0*A; C(tf) = B(:,2); M = [A C]

alrededor de 14 años hace | 0

Respondida
Prevent MATLAB from adding \Documents\MATLAB to the top of the search path
Put rmpath('\Documents\MATLAB') in |startup.m|. You may need to use 'C:\Documents\MATLAB'; I don't have a Windows environmen...

alrededor de 14 años hace | 0

Respondida
How do i find one string with another?
The trick is to use regular expressions. The first line below searches for any string that has one or more integers between '1/...

alrededor de 14 años hace | 0

| aceptada

Cargar más