Wednesday, December 22, 2004

The MATLAB blog

Over the course of my research and work I have accumulated a fair share of MATLAB hacks where I have used MATLAB to accomplish tasks that go beyond the usual equation-solving and numerical-simulations routines. Mostly I have been motivated by my own laziness and reluctance to code everything in C, or to use a combination of tools, but as I have discovered along the way, MATLAB is truly a very powerful tool and allows you to accomplish complicated stuff using very simple commands. If you have any interesting ways of using MATLAB, feel free to send them in and I will duly acknowledge your contribution. Enjoy!

38 comments:

charles said...

your blog seems very interesting, do you know LP.org:
http://en.literateprograms.org

it has a matlab section in which you could add and comment your code. I use it personnaly and find this very usefull (see the "code" tab on the top of the pages),
Charles

Aneet said...

One of the interesting things is to use the in-built matlab command, RECTANGLE, with a curvature paramenter to draw a circle!

There is also a method of converting a cell array to a normal array. Consider the cell array c{i,j}

A = [c{:}];
converts the cell array to a normal one!

Anonymous said...

<>

Anonymous said...

< Is there any tool like SimAuto.If yes Anyone working on SimAuto?>

Anonymous said...

I am trying to find out more about MATLAB users, and I want to know if anyone uses the Optimization Toolbox??? Why do you prefer this optimizer versus other optimizers on the market? Why would or wouldn't you make the switch? Why would or wouldn't you purchase a different optimizer plug-in to MATLAB's interface??? I'm not biased, but I am really curious to hear what people think! Thanks!

Anonymous said...

hi, i am an student. i get an project on image processing.please can anyone tell me why MATLAB is good tool for image processing?
i found another tool CVIP tool. please can anyone tell me which one is good and why.
if anyone can tell me please then help me it will be a great help for me.
waiting for reply. thank all of u for you help if any u can do.

Anil said...

Image processing (like any other signal processing) involves plenty of matrix manipulation which is MATLAB's forte. You will also find the image processing toolbox useful (which you will probably have at your university)

For most of your work though, do check out Octave which will give you a lot of functionality for free.

Anonymous said...

ya i know matab is good tool.But my Guide want a comparison between matab and other tools like CVIP.I searched a lot on net but there is no such thing related to comparison. so can anyone tell me what is the good feature of matlab over CVIP tool. And why matlab is best. or is there any other tool which is better then matlab then lz tell me...

thank for ur effort and help

Anonymous said...

Kostenloses Mathematikprogramm wie MATLAB und kompatibel zu MATLAB:

Bericht

Anonymous said...

i am trying to do VRP optimisation in Matlab. pls someone can help me with the coding as i am standstill now...Stuck with a situation of how to goahead .URGENT.PLs help

Tapan said...

I am looking to download embedded target....

Anonymous said...

Can anyone help me here - I'm a new Matlab user and having problems getting this to run. This equation will not compute correctly:

The code starts here:

clear
clc
g = 32.2
row = 0.00238


prompt = {'Enter the UAV weight in lbs:', 'Enter the UAV Max airspeed in knots:', 'Enter the UAV Max altitude in feet:','Enter the UAV loss of comms in seconds:'};
title = 'Hazard Pattern Dynamic Data';
lines = 1;
answerdynamic = inputdlg(prompt, title, lines);

button=questdlg('Does the UAV contain a parachute?', 'Yes','No');
if strcmp(button, 'Yes');
prompt = {'What is the parachute Cd?','What is the parachute cross sectional area in feet squared?'};
title = 'Parachute Information';
lines = 1;
answerpara = inputdlg(prompt, title, lines);
else
end



WT=answerdynamic{1,1}
VS=answerdynamic{2,1}
ALT=answerdynamic{3,1}
COMM=answerdynamic{4,1}
CD=answerpara{1,1}
CAREA=answerpara{2,1}

Dist=(VS*(0.59209))*COMM

med-enis said...

i dont understand very well how to use s-fonction for the control of hybride state space can u please sendme a document or give me some information to mohamedbahloul.ge@yahoo.fr

med-enis said...

i dont understand very well how to use s-fonction for hybride controle of state space can u send me a document or some information

ferrari said...

hey i'm having problem with skeletonization...hav neone been involved in skeletonization........

ferrari said...

here's the code i wrote...its giving no where close to the result required...........
function [row,col]=skl(bpm),
[nrows,ncols]=size(bpm);
bpm(1,:)=0; bpm(:,1)=0;
for col=2:ncols-1
for row=2:nrows-1
if bpm(row,col)>0
if bpm(row-1,col)== 0
if bpm(row,col-1)== 0
if bpm(row,col+1)>0
if bpm(row+1,col+1)>0
if bpm(row+1,col)>0
bpm(row,col)== 0
end
end
end
end
end
end

if bpm(row,col)>0
if bpm(row-1,col)> 0
if bpm(row,col-1)== 0
if bpm(row,col+1)>0
if bpm(row+1,col) == 0
if bpm(row-1,col+1)>0
bpm(row,col)== 0
end
end
end
end
end
end
if bpm(row,col)>0
if bpm(row-1,col+1)> 0
if bpm(row,col+1)> 0
if bpm(row,col-1)==0
if bpm(row+1,col+1) > 0
bpm(row,col) == 0
end
end
end
end

%north part starts here....

if bpm(row,col)>0
if bpm(row-1,col)== 0
if bpm(row,col-1)> 0
if bpm(row,col+1)== 0
if bpm(row+1,col-1)>0
if bpm(row+1,col)>0
bpm(row,col)== 0
end
end
end
end
end
end

if bpm(row,col)>0
if bpm(row-1,col)== 0
if bpm(row,col-1)== 0
if bpm(row,col+1)>0
if bpm(row+1,col+1)>0
if bpm(row+1,col)>0
bpm(row,col)== 0
end
end
end
end
end
end
if bpm(row,col)>0
if bpm(row-1,col)== 0
if bpm(row+1,col)> 0
if bpm(row+1,col+1)>0
if bpm(row+1,col-1) > 0
bpm(row,col) == 0
end
end
end
end
%east part starts here......
if bpm(row,col)>0
if bpm(row-1,col)> 0
if bpm(row,col+1)== 0
if bpm(row+1,col)== 0
if bpm(row,col-1) >0
if bpm(row-1,col-1)>0
bpm(row,col)== 0
end
end
end
end
end
end

if bpm(row,col)>0
if bpm(row-1,col)== 0
if bpm(row,col-1)> 0
if bpm(row,col+1)== 0
if bpm(row+1,col-1)>0
if bpm(row+1,col)>0
bpm(row,col)== 0
end
end
end
end
end
end

if bpm(row,col)>0
if bpm(row,col-1)> 0
if bpm(row-1,col-1)> 0
if bpm(row+1,col-1)>0
if bpm(row,col+1) == 0
bpm(row,col) == 0
end
end
end
end

% south part starts here

if bpm(row,col)>0
if bpm(row-1,col)> 0
if bpm(row,col-1)== 0
if bpm(row,col+1)>0
if bpm(row+1,col) == 0
if bpm(row-1,col+1)>0
bpm(row,col)== 0
end
end
end
end
end
end

if bpm(row,col)>0
if bpm(row-1,col)> 0
if bpm(row,col+1)== 0
if bpm(row+1,col)== 0
if bpm(row,col-) >0
if bpm(row-1,col-1)>0
bpm(row,col)== 0
end
end
end
end
end
end

if bpm(row,col)>0
if bpm(row-1,col-1)> 0
if bpm(row-1,col+1)> 0
if bpm(row-1,col)> 0
if bpm(row,col+1) == 0
bpm(row,col) == 0
end
end
end
end

end
end

ferrari said...

i know tht the above code is screwed....but plz help me soon

Unknown said...

need help
I'm a newbie at the matlab field, I got a final assignment on my university of making a very simple rainfall prediction. it simply predicts the amount of rainfall (in kg/square meters) from thye temperature(in celcius) and the moisture of the air, with possibly other inputs but these are the most prominent ones. to be honest I am not really in to matlab, but in order to finish school quick, I gotta bite the bullet, can anyone give a simple program script that answers this task, I tried to use neural networks but got confused trying to find the best method, need help. reach me here syaputra84@gmail.com thank you.

Anonymous said...

Hi i have started programming MATLAB and just wanted to know in the textread function,is there an option availabla so as to allow the user to enter the filename from which the data has to be read instead of providing it directly.
Since i would like to run the same programme with different sets of data .
Thanks in advance

Anonymous said...

i am a student. i want to write program with matlab for first order sigma delta modulation .anybody helpl me ?

Anonymous said...

I am trying to plot a scatter graph and a bar graph on the same axis. I want the scatter graph to use the left hand side y axis (which I have done) however I want the bar graph to use the left hand side y axis. does anyone know how to do this?

Anonymous said...

Can anyone help me???

I have a vector y(t) of 101 points and I want to integrate it from t=0s to t=100s (step=1s - 101 points). It isn't possible to obtain any espression y=f(t).

In 'Mathematica' the command is "ListIntegrate". How is the same in MATLAB????

Thanks!!!

Kristin said...

Inference for MATLAB (http://www.inferenceForMATLAB.com) is a new software platform that makes it possible to use MATLAB within Microsoft Word and Excel. Users get the advantage of familiar MS Office tools and functionality plus MATLAB scripting to generate results documents. The original data, software objects, scripting commands and commentary are always tied to the results document, so it’s easy to tell where results came from, use it as a template for automating repetitive tasks involving data access, collection, preparation, analysis and reporting in Excel or Word. Inference also addresses some weak spots in MATLAB – especially MATLAB’s Publish and Notebook functions. I work for Blue Reference (the creators of Inference), so of course I’m excited about it. But I’d love anyone’s comments or thoughts – Inference for MATLAB is still in development and we welcome all feedback to help us improve it. Inference for MATLAB is available for a free 120-day trial. The commercial release is coming later this winter.

sandipank said...

Hi,
I am a master's student of Industrial Engineering at IIT Kharagpur. I have got an assignment on Optimizing a function by GA in MATLAB. Can anyone help me how to proceed...need help...
my mail id is sandipank@gmail.com
Thanks in advance...

Anonymous said...

nice post! thanks for sharing with us your useful information

Unknown said...

hi friends,iam doing my project in matlab....
i dont know how to use the "evalfis" command...
can you please send me example program for two dimensional array of elements given in to the evalfis command

Unknown said...

hi friends,iam doing my project in matlab....
i dont know how to use the "evalfis" command...
can you please send me example program for two dimensional array of elements given in to the evalfis command

my maile id is thameemece@gmail.com

FAO said...

hi i m implementing PID controller and wand to use c2d command. my problem is defining my own method other than
'zoh'
'tustin'
'prewarp'
'matched' can some1 guide me. Regards faisalobaid74@gmail.com

Anonymous said...

needed pls-toolbox, is anyone have ?

faizul said...

i have problem for load a content MAT file. Anybody can help me?
i already execute M file and that executed file saved in MAT file. i need to load again that file...how do that???

Anonymous said...

Hello sir

Iam rahul from vizag I need ur help in matlab can u please

TITLE: EXTRACTING THE CIRCLES IN AN IMAGE AND FIND THE RADIUS OF THE CIRLCE..

RELATED TOPICS: THRESHOLDING,EDGE DETECTION,HOUGH TRANSFORM

i need the mat lab coding to extract the circles in a given image and
to find the radius of the circle.

as far as my professor description,this is done by a simple procedure like converting the image into gray scale image and find the circles by edge detection method and using the hough transform need to extract the circle and determining the radius of the circle,,

am not familiar with the hough transform and edge detection ,so i need ur help in coding as am running out of time plsss.

thanks in advance


. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

albert said...

Here you have a free online calculator compatible with Matlab:

http://www.mathator.com

If you are using Matlab like an advanced calculator, you will find it useful, available from everywhere and every computer.

prashant said...

Write a program that reads in a matrix
A, a RHS vector b, and bound vectors l and u and produces all possible
basic and basic feasible solutions

i want code for this...can anybody gv me?

Towhid said...

choice=menu('FR',
'1. Read Image',...
'2. Detect');

save R;


if choice==1,
readimage;
load R;
end;


if choice==2
detect;
load R;
end;

*****************************
In the above code creates a file named R which is actually a Microsoft Access Table Shortcut. But what is the contain of that access file? Someone plz help me... plz...

Anonymous said...

Hi, I want to draw a curve from center of circle to its circumference so that its curvature at any point is higher than that of the circle (like twice, thrice). can it be solved by Matlab.

With Regards
Limmil

Manish Sahay said...

urgently need a matlab code for speed control of 3 phase induction motor using fuzzy logic.

rajesh said...

does matlab function performs pixel based or image based processing? motivate???
Ans) i guess it that it will peform both because pixel is nothing but smalest part of image. so, mainly it scopes much in image processing at the same time image means combining of pixcels so....matlab function performs pixcel based processing...


I thought that the above answer is 50% coorcet so, i need a good answer with practicality. can any one help me ...plz update it...

david carollo said...

hi everyone!
i'm a newbie in matlab..i've to make an image processing project..something know a script to extract from a directory of images the medium values of HSV(Hue, Saturation & Value)?

Thank u, dave!

Moving to a new website

This website was intended to be a little collection of tips and tricks, but I haven't been able to update it as often as I originally in...