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

etwa 14 Jahre vor | 2

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

etwa 14 Jahre vor | 1

| akzeptiert

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

etwa 14 Jahre vor | 0

| akzeptiert

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

etwa 14 Jahre vor | 2

| akzeptiert

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

etwa 14 Jahre vor | 0

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

etwa 14 Jahre vor | 0

| akzeptiert

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

etwa 14 Jahre vor | 2

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

etwa 14 Jahre vor | 1

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

etwa 14 Jahre vor | 1

| akzeptiert

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

etwa 14 Jahre vor | 0

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

etwa 14 Jahre vor | 1

| akzeptiert

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

etwa 14 Jahre vor | 0

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

etwa 14 Jahre vor | 0

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

etwa 14 Jahre vor | 2

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

etwa 14 Jahre vor | 0

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

etwa 14 Jahre vor | 1

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

etwa 14 Jahre vor | 0

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

etwa 14 Jahre vor | 0

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

etwa 14 Jahre vor | 0

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

etwa 14 Jahre vor | 0

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

etwa 14 Jahre vor | 0

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

etwa 14 Jahre vor | 0

| akzeptiert

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

etwa 14 Jahre vor | 0

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

etwa 14 Jahre vor | 0

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

etwa 14 Jahre vor | 0

| akzeptiert

Beantwortet
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:/...

etwa 14 Jahre vor | 0

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

etwa 14 Jahre vor | 0

| akzeptiert

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

etwa 14 Jahre vor | 0

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

etwa 14 Jahre vor | 0

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

etwa 14 Jahre vor | 0

| akzeptiert

Mehr laden