已回答
i dunno why it run until 4th iteration then stopped...can anybody help me? it did not give any error...
OK, with the disclaimer that what you have there isn't a particularly optimal way to write this code, you can fix your problem b...

13 years 前 | 0

| 已接受

已回答
How to plot Message Signal using MATLAB ?? (Quick Question Need Help)
First, note that the integral of the message will be zero up to any multiple of 2*pi. The integral will then be a piecewise line...

13 years 前 | 1

| 已接受

已回答
How to plot Message Signal using MATLAB ?? (Quick Question Need Help)
m_1 = @(t) 2*(cos(t) >= 0) - 1 t = linspace(0, 100); stairs(t, m_1(t))

13 years 前 | 1

已回答
i dunno why it run until 4th iteration then stopped...can anybody help me? it did not give any error...
It stops because |dv1| drops below its threshhold, causing the loop to quit.

13 years 前 | 0

已回答
i dunno why it run until 4th iteration then stopped...can anybody help me? it did not give any error...
You're going to struggle to get someone to answer (let alone read) this question. I would suggest using the debugger to step ...

13 years 前 | 0

已回答
Output of mod() for large input
@Walter Roberson is correct, in R2012a MATLAB automatically casts the number into a |uint64|. For this piece of code [mod(2...

13 years 前 | 0

| 已接受

已回答
surface integral of discrete data
Sorry, I read your question too fast and pointed you to code for surface *area*, not surface integral. In this case it's even ea...

13 years 前 | 0

已回答
How can I solve this linear System?
And another way (which could be chained into a very long one-liner). First, assuming you have the following test data: % Te...

13 years 前 | 2

已回答
'closeness' of multiple vectors
Is closeness a measure of how many entries match in matching positions? In this case: closeness = @(x, y) nnz(x == y) / num...

13 years 前 | 0

| 已接受

已回答
How to assign parts of a matrix equal to a single vector
It's because |y(2:4, 2:4)| is a 3x3 matrix, and so you must assign it a 3x3 matrix. The command |repmat| is an easy way to stack...

13 years 前 | 0

| 已接受

已回答
Additional ODE solvers in Matlab?
You could try sundials <https://computation.llnl.gov/casc/sundials/main.html>, they have a suite of good solvers and provide a M...

13 years 前 | 0

| 已接受

已回答
How to replace some of the value in the matrix with NaN?
This is another one of these problems where the simplest way to solve it is to randomly generate candidates until you find one t...

13 years 前 | 0

已回答
runge-kutta
I'll give you the high level overview, you'll need to write the code though # Turn it into a system of two first order equati...

13 years 前 | 3

已回答
surface integral of discrete data
This came up recently -- in this thread there is code for computing the surface area based on dividing a regular mesh into trian...

13 years 前 | 0

已回答
extracting a 2d plane from a 3d surface plot
How about contour(x, y, z1-z2, [0 0]) ?

13 years 前 | 1

| 已接受

已回答
How to "stretch" matrix
Further to Image Analyst's answer, you can do it without the image processing toolbox too (assuming m has an even number of entr...

13 years 前 | 1

已回答
extracting a 2d plane from a 3d surface plot
Plotting the plane is pretty easy surf(x, y, zeros(size(x)) You can adjust colour, edgecolor, transparency etc if you wa...

13 years 前 | 0

已回答
Strange problem - vector dimensions
My guess is that there is a variable called 'A' in your 7th m-file. What if you call your array AAA (to avoid naming conflicts) ...

13 years 前 | 1

| 已接受

已回答
Help with finding and plotting interpolating polynomials
I presume you mean c0 + c1x + c2x^2 + c3x^3 + c4 x^4 + c5 x^5 The system of equations method means treating c0 ... c5 as unkn...

13 years 前 | 0

已回答
How to sample from custom 2D distribution?
A really basic, quick to code (but darned inefficient way) is to generate uniform samples in the 3D volume defined by the x and ...

13 years 前 | 1

已回答
Plotting heaviside unit step functions
If you replace the line with the heavisides in it with the one from my previous answer dydt(2) = (A*t >= 0) + 4*(A*(t-1) >=...

13 years 前 | 1

| 已接受

已回答
Plotting heaviside unit step functions
heaviside is a function from the symbolic toolbox - I'd be surprised your code doesn't complain when you try to call it. Why ...

13 years 前 | 0

已回答
Economical use of memory
Matlab's semantics are pass-by-value but it only actually copies the matrix if you modify it within your function, "lazy copy" o...

13 years 前 | 0

已回答
Why do you come to "MATLAB Answers"?
When I get blocked with my research, here at least I can make an epsilon contribution to something ...

13 years 前 | 1

已回答
Why not use square brackets?
OK, I looked into this a little more rigorously. I thought I'd test James Tursa's suggestion from my previous answer to see if t...

13 years 前 | 3

已回答
Why not use square brackets?
A quick test reveals that there is a small cost to including them tic for i = 1:1000000 A = [1:100]; end t1...

13 years 前 | 1

已回答
??? Subscript indices must either be real positive integers or logicals. Using findpeaks
You've probably declared a variable called findpeaks by accident. Try which findpeaks and confirm it's actually pointin...

13 years 前 | 1

已回答
MATLAB in unexpected places
On an episode of Harry's law (I can't remember which one), Tommy Jefferson (a fast-talking lawyer) boasts about a number of laws...

13 years 前 | 0

已回答
matlab function
Why not just [M, N] = find(I, 1, 'first') ?

13 years 前 | 0

已回答
Surface area from a z-matrix
If your data is smooth enough (assuming that's what you're after), then there is a really quick way to work out approximately th...

13 years 前 | 1

加载更多