Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to convert the graph into a signal equation?

Status
Not open for further replies.

quantumeb

Newbie level 6
Joined
Jan 2, 2006
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,422
I used the "improfile" command of matlab to get the intensity profile of a certain image... However, i need to compute frequency for the fft and I want to transform the "improfile" graph into certain wave or signal equation as x(t)... How can I get Amplitude, frequency, x data, y data from "improfile"

Please help...

thanks
D
 

hi & happy new year
use matlab curve fitting function.
 

    quantumeb

    Points: 2
    Helpful Answer Positive Rating
smxx said:
hi & happy new year
use matlab curve fitting function.

Hi, do you know the syntax for that???

tnx
 

Hmmm, unclear question. You don't need to convert the improfile data into a function to do an FFT.

Here is a slightly modified version of MATLAB's improfile help example:

I = imread('liftingbody.png');
x = [19 427 416 77];
y = [96 462 37 33];
c = improfile(I, x, y);
h = fft(c);
 

    quantumeb

    Points: 2
    Helpful Answer Positive Rating
echo47 said:
Hmmm, unclear question. You don't need to convert the improfile data into a function to do an FFT.

Here is a slightly modified version of MATLAB's improfile help example:

I = imread('liftingbody.png');
x = [19 427 416 77];
y = [96 462 37 33];
c = improfile(I, x, y);
h = fft(c);

thanks for the reply... but, how can I get the frequency value (omega), amplitude, x & y coordinate??? can I just extract it from "c" based on the above example???
 

The FFT give you the amplitudes of all the frequency components of the data.

I'm not sure what x and y coordinates you want. improfile gives intensity values along the path you specify. If you want the coordinates of the points along that path, use this alternate form as shown in MATLAB's help:
[cx,cy,c] = improfile(...)
 

thanks for that and I will try it later tonight...
I am still in my working place... :cry:
 

echo47 said:
Hmmm, unclear question. You don't need to convert the improfile data into a function to do an FFT.

Here is a slightly modified version of MATLAB's improfile help example:

I = imread('liftingbody.png');
x = [19 427 416 77];
y = [96 462 37 33];
c = improfile(I, x, y);
h = fft(c);

A = imread('ANY FILENAME');
B = rgb2gray(A);
imshow(B);
[cx,cy,c] = improfile >> I drew a line in the image and showed me all the values of cx, cy and c
D = fft(c);
imshow(fftshift(D));

What matlab function should i use to see the fft graph??? I got a straight a line...
 

Your code seems incomplete and gives me error messages.

imshow is for displaying an image, not for plotting a graph.

Try this:

I = imread('liftingbody.png');
x = [19 427 416 77];
y = [96 462 37 33];
c = improfile(I, x, y);
h = fft(c);
plot(abs(h));
 

    quantumeb

    Points: 2
    Helpful Answer Positive Rating
echo47 said:
Your code seems incomplete and gives me error messages.

imshow is for displaying an image, not for plotting a graph.

Try this:

I = imread('liftingbody.png');
x = [19 427 416 77];
y = [96 462 37 33];
c = improfile(I, x, y);
h = fft(c);
plot(abs(h));

Yes, you are right... I forgot the last line of log function and the mat2gray...
Anyway, you should be able to get a straight line from there after getting improfile...
Btw, i am curious about the x = [19 427 416 77] & y = [96 462 37 33]...
How did you get this number...
I am getting 360 (y component) & 575 (x component) from size (I)... Actually, I wanted to get the intensity profile in the middle...
somewhere y = 180 from x = 1 to 574...
How should I fit this number into your x = [] & y=[]... which one is the initial x value, final x value, initial y value and final y value...

thanks
again
 

I simply copied those numbers from MATLAB's example. ;) Type "doc improfile" and you will see it. The path has three line segments, so there are four (x,y) points. (I'm using MATLAB 7.0.1 -- your version may have different examples.)

If you want your (x,y) path to go from (1,180) to (574,180), then this should work:
x = [1 574];
y = [180 180];
 

    quantumeb

    Points: 2
    Helpful Answer Positive Rating
echo47 said:
I simply copied those numbers from MATLAB's example. ;) Type "doc improfile" and you will see it. The path has three line segments, so there are four (x,y) points. (I'm using MATLAB 7.0.1 -- your version may have different examples.)

If you want your (x,y) path to go from (1,180) to (574,180), then this should work:
x = [1 574];
y = [180 180];

thanks for that... I will try that later...
I am using Matlab 6.1.... :D
 

A = imread('ANY FILENAME');
B = rgb2gray(A);
x = [1 574];
y = [180 180];
c = improfile(B, x, y);
h = fft(c);
d = fftshift(h);
plot(abs(d));

I used the above codes and able to get a fft transform picture with a SHARP PEAK some where nearby 300 (x -axis should be the frequency axis)... Is there any built in Matlab function to get a certain value that I might be needed for x and y axis? STEM??? Frequecy built in function...
[/quote]
 

I see the nice peak.

Please clarify "get a certain value that I might be needed". I can't decypher your grammar.
 

echo47 said:
I see the nice peak.

Please clarify "get a certain value that I might be needed". I can't decypher your grammar.

Ok... you see the peak... so what is the corresponding x & y values for that SHARP PEAK... In x axis, it get close to the 300... so what should be the exact value? 281?
In y axis, it is in between 7 and 8 X 10-4... so what should be the amount...
Furthermore, I want to know the exact value of a certain point in the graph...
How can i get it?

Thanks
:D
 

In your MATLAB Workspace tab, you can double-click the array name (or type "openvar arrayname") to open Array Editor. Then you can examine all the array data. Or you can simply type the array name and MATLAB will display its data.

If you want to locate the maximum value in the array, try this:
[x,y] = max(arrayname);

You can display a data point value directly in the plot() window. Click the "Data Cursor" button, and then click a point on the curve, or drag your cursor over the curve. Use Alt-Click to display multiple points.
 

    quantumeb

    Points: 2
    Helpful Answer Positive Rating
echo47 said:
In your MATLAB Workspace tab, you can double-click the array name (or type "openvar arrayname") to open Array Editor. Then you can examine all the array data. Or you can simply type the array name and MATLAB will display its data.

If you want to locate the maximum value in the array, try this:
[x,y] = max(arrayname);

You can display a data point value directly in the plot() window. Click the "Data Cursor" button, and then click a point on the curve, or drag your cursor over the curve. Use Alt-Click to display multiple points.

Tnx... I will try it later... :D
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top