10 views (last 30 days)

Show older comments

I have attached two figures

1. Error1.jpeg (which shows two figures on upper and lower half according to the code i posted)

2. correct.jpeg (This is how the figure should look like ,i want it to be projected on top of the original figure)

Here are the images

And here is the code :

file = 'idle_coil_for_imag_real.xlsx' ;

[num,txt,raw] = xlsread(file) ;

imag = num(:,2) ;

real = num(:,1) ;

%plot(real,imag,'*')

%[xx,yy] = pol2cart(x,y);

k = convhull(real, imag);

xch = real(k);

ych = imag(k);

%[xCH, yCH] = cart2pol(xch, ych);

plot(xch, ych, 'ro-','LineWidth', 1);

hold on

plot(real,imag,'b*','LineWidth', 1);

%plot(xch, ych, 'ro-',real,imag,'b*');

xlabel('real');

ylabel('imag');

title('IDLE','FontSize',10);

hold on

% Plot lines for a tolerance band above and below the perfect signal.

tolerance = 0.1; % Whatever you want.

yUpperLimit = ych + tolerance;

yLowerLimit = ych - tolerance;

xUpperLimit = xch + tolerance;

xLowerLimit = xch - tolerance;

plot(xUpperLimit, yUpperLimit, 'g.-', 'LineWidth', 1, 'MarkerSize', 14, 'Color', [0, 0.5, 0]);

plot(xLowerLimit, yLowerLimit, 'g.-', 'LineWidth', 1, 'MarkerSize', 14, 'Color', [0, 0.5, 0]);

Walter Roberson
on 9 Feb 2017

You have

tolerance = 0.1; % Whatever you want.

yUpperLimit = ych + tolerance;

0.1 is large compared to your values, so you are shifting the plotting a fair bit.

One approach would be to find the centroid of your signal, and then calculate the difference in coordinates between that and your boundary points. Convert to polar. Multiply the radius by 1.1 and convert back. Add to the centroid to get the new boundary. Likewise, you can multiply the radius by 0.9 instead of 1.1.

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!