matlab

How do we plot a red dot (to represent a trade) on a financial candlestick chart in MATLAB?

I am plotting a financial candlestick chart using this MATLAB function: http://www.mathworks.com/access/helpdesk/help/toolbox/finance/candlefts.html How do I plot a red dot on the chart, to represent a trade at that point? ...

matlab-like variable editor in python

is there a data viewer in python/ipython like the variable editor in MATLAB? ...

Problem in matlab with too many outputs

I am writing a Matlab program for simpson's rule I keep getting an error about to many outputs when the program gets to left_simpson = Simpson(a,c,(e1)/2,level, level_max); What is wrong with settinf left_simpson to Simpson(a,c,(e1)/2,level, level_max);? function Simpson(a,b,e1,level, level_max) level = level + 1; h = b - a; c = (a+...

What is the shortest way to write this in matlab ?

lam1 = 0.0:0.1:4.0 lam = 1.60*lam1-0.30*lam1^2 for 0<lam1<=1 lam = lam1+0.30 for 1<=lam1<=4 I have a bunch of those. What would be the 'matlab way' of writing that kinda stuff, short of simple looping by indexes and testing the values of lam1 ? ...

Does Python/Scipy have a firls( ) replacement (i.e. a weighted, least squares, FIR filter design)?

I am porting code from Matlab to Python and am having trouble finding a replacement for the firls( ) routine. It is used for, least-squares linear-phase Finite Impulse Response (FIR) filter design. I looked at scipy.signal and nothing there looked like it would do the trick. Of course I was able to replace my remez and freqz algoriths...

Faster projected-norm (quadratic-form, metric-matrix...) style computations

I need to perform lots of evaluations of the form X(:,i)' * A * X(:,i) i = 1...n where X(:,i) is a vector and A is a symmetric matrix. Ostensibly, I can either do this in a loop for i=1:n z(i) = X(:,i)' * A * X(:,i) end which is slow, or vectorise it as z = diag(X' * A * X) which wastes RAM unacceptably when X has a lot of...

Mean filter in MATLAB without loops or signal processing toolbox

I need to implement a mean filter on a data set, but I don't have access to the signal processing toolbox. Is there a way to do this without using a for loop? Here's the code I've got working: x=0:.1:10*pi; noise=0.5*(rand(1,length(x))-0.5); y=sin(x)+noise; %generate noisy signal a=10; %specify moving window siz...

How do I remove an array dimension where the elements sum to zero?

I am assigning a 3D array, which contains some information for a number of different loadcases. Each row in the array defines a particular loadcase (of which there are 3) and I would like to remove the loadcase (i.e. the row) if ALL the elements of the row (in 3D) are equal to zero. The code I have at the moment is: Array = zeros(3,5) ...

What's the fastest way to approximate the period of data using Octave?

I have a set of data that is periodic (but not sinusoidal). I have a set of time values in one vector and a set of amplitudes in a second vector. I'd like to quickly approximate the period of the function. Any suggestions? Specifically, here's my current code. I'd like to approximate the period of the vector x(:,2) against the vector t....

MATLAB - Delete elements of binary files without loading entire file

This may be a stupid question, but Google and MATLAB documentation have failed me. I have a rather large binary file (>10 GB) that I need to open and delete the last forty million bytes or so. Is there a way to do this without reading the entire file to memory in chunks and printing it out to a new file? It took 6 hours to generate the f...

Getting help on MATLAB's com.mathworks internals

It is possible to access bits of MATLAB's internal java code to programmatically change MATLAB itself. For example, you can programmatically open a document in the editor using editorServices = com.mathworks.mlservices.MLEditorServices; editorServices.newDocument() %older versions of MATLAB seem to use new() You can see the method s...

importing C written binary files into Matlab

Hi, I've read the post "Read and write from/to a binary file in Matlab" but I still have doubts. I have a binary file of long double values created with fwrite in C and in Matlab I'm using fid = fopen('vz3.dat', 'r') mydata = fread(fid, 'double') where vz3.dat is my file. But I'm getting garbage values in Matlab. According to [ci...

How do I load and show a PNG image in MATLAB?

>> I = imread('D:\Works\matlab\SecCode.php.png','png'); >> imshow(I); The above code always shows an all-black image. What's wrong with it? The image I'm using is this one: ...

Does the return value of a MATLAB function depend on how it's called?

A = imread(filename, fmt) [X, map] = imread(...) The above is in the synopsis part of imread, which seems to say that the return value of a MATLAB function depends on how it's called? Is that true? ...

How do I use graythresh on an indexed image in MATLAB?

I = imread('coins.png'); level = graythresh(I); BW = im2bw(I,level); imshow(BW) The above is an example from the MATLAB documentation using a grayscale image. How can I make it work with an indexed image like in this post? ...

skip reading headers in matlab

I had a similar question. but what i am trying now is to read files in .txt format into matlab. My problem is with the headers. Manytimes due to errors the system rewrites the headers in the middle of file and then matlab cannot read the file. IS there a way to skip it? I know i can skip reading some characters if i know what the charact...

matlab code for the horizontal mean filter

how to apply a horizontal mean filter to a spectogram in matlab??? ...

How can I implement this visual effect in MATLAB?

One can use Google's logo for a try: BTW, what's the term for it? ...

Matlab: Analysis of signal

Hi, I have a problem with this task: For free route perform frequency analysis and give parametrs of each signal component: time of beginning and ending of each component beginning and ending frequency amplitude (in time domain) in the beginning and end of each signal's component level of noise in dB Assume, that, the parametrs of e...

Infrared image processing in Matlab

i would like to process infrared imaging in Matlab. Any kind of processing or techniques. Is there any built-in function in Matlab? And can anyone suggest any books or articles,as well as resources for sample Far Infrared images. Thanks! ...