Hi, I want the tolerance around this figure, I have posted the code ,where i am getting two figures on the upper and lower halfs of the original figure, which is shown in the attached image.Can anyone tell me what changes i must do ?

5 ビュー (過去 30 日間)
L K
L K 2017 年 2 月 9 日
コメント済み: L K 2017 年 2 月 10 日
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]);

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 2 月 9 日
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.
  6 件のコメント
Walter Roberson
Walter Roberson 2017 年 2 月 10 日
Attached code that draws the +/- 0.1 around the data in polar space
L K
L K 2017 年 2 月 10 日
Thanx a lot Sir :) Its done :)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCommunications Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by