How to find value on the graph

9 views (last 30 days)
Offroad Jeep
Offroad Jeep on 17 Oct 2018
Edited: KALYAN ACHARJYA on 17 Oct 2018
Hi To All, the following values plot a hysteresis graph. I want to check what is the value of Mag_Field for Magnetization = 0 on positive x and negative x axes..... Regards
B=[1 0.9286 0.8571 0.7857 0.7143 0.6429 0.5714 0.5 0.4286 0.3571 0.2857 0.2143 0.1429 0.0714 0 -0.0714 -0.1429 -0.2143 -0.2857 -0.3571 -0.4286 -0.5 -0.5714 -0.6429 -0.7143 -0.7857 -0.8571 -0.9286 -1 -0.9286 -0.8571 -0.7857 -0.7143 -0.6429 -0.5714 -0.5 -0.4286 -0.3571 -0.2857 -0.2143 -0.1429 -0.0714 0 0.0714 0.1429 0.2143 0.2857 0.3571 0.4286 0.5 0.5714 0.6429 0.7143 0.7857 0.8571 0.9286 1]
B=B'
M = [0.988 0.9993 0.9971 0.9912 0.9918 0.9852 0.9777 0.9697 0.9604 0.9476 0.9229 0.9206 0.883 0.8488 0.8 0.74 0.609 0.4753 0.2868 -0.0352 -0.3133 -0.6251 -0.8118 -0.9346 -0.9835 -0.999 -0.9988 -0.9937 -0.9935 -0.9922 -0.9912 -0.9917 -0.9911 -0.9844 -0.9762 -0.9708 -0.9621 -0.9531 -0.9432 -0.9422 -0.9251 -0.8979 -0.8578 -0.7911 -0.7061 -0.5588 -0.359 -0.1184 0.2288 0.5402 0.7588 0.8951 0.9752 0.9977 0.9991 0.9949 0.9923 ]
M = M'
Mag_Field = B
Magnetization = M
plot(Mag_Field, Magnetization, 'r--*')
xlabel('Magnetic Field B')
ylabel('Magnetization')
grid on

Answers (2)

KALYAN ACHARJYA
KALYAN ACHARJYA on 17 Oct 2018
Edited: KALYAN ACHARJYA on 17 Oct 2018
B=[1 0.9286 0.8571 0.7857 0.7143 0.6429 0.5714 0.5 0.4286 0.3571 0.2857 0.2143 0.1429 0.0714 0 -0.0714 -0.1429 -0.2143 -0.2857 -0.3571 -0.4286 -0.5 -0.5714 -0.6429 -0.7143 -0.7857 -0.8571 -0.9286 -1 -0.9286 -0.8571 -0.7857 -0.7143 -0.6429 -0.5714 -0.5 -0.4286 -0.3571 -0.2857 -0.2143 -0.1429 -0.0714 0 0.0714 0.1429 0.2143 0.2857 0.3571 0.4286 0.5 0.5714 0.6429 0.7143 0.7857 0.8571 0.9286 1];
Mag_Field=B';
M=[0.988 0.9993 0.9971 0.9912 0.9918 0.9852 0.9777 0.9697 0.9604 0.9476 0.9229 0.9206 0.883 0.8488 0.8 0.74 0.609 0.4753 0.2868 -0.0352 -0.3133 -0.6251 -0.8118 -0.9346 -0.9835 -0.999 -0.9988 -0.9937 -0.9935 -0.9922 -0.9912 -0.9917 -0.9911 -0.9844 -0.9762 -0.9708 -0.9621 -0.9531 -0.9432 -0.9422 -0.9251 -0.8979 -0.8578 -0.7911 -0.7061 -0.5588 -0.359 -0.1184 0.2288 0.5402 0.7588 0.8951 0.9752 0.9977 0.9991 0.9949 0.9923];
Magnetization=M';
plot(Mag_Field,Magnetization,'r--*');
xlabel('Magnetic Field B');
ylabel('Magnetization');
grid on;
%Magnetization=cell2mat(Magnetization);
idx1=find(Magnetization<=0, 1,'last');
%idx=find(Magnetization==0.9852);
idx2=knnsearch(Magnetization,0);
%idx2=find(Magnetization<0, 1,'last');
fprintf('The Magnetic Field value is %.4f in +ve axis',Mag_Field(idx1));
idx=find(Magnetization>=0, 1,'last');
fprintf('\nThe Magnetic Field value is %.4f in -ve axis',Mag_Field(idx2));
Command Window
The Magnetic Field value is 0.3571 in +ve axis
The Magnetic Field value is -0.3571 in -ve axis>>
Both value exist in B array.

dpb
dpb on 17 Oct 2018
Alternatively to just finding point in the dataset..
ix=find(abs(B)==1); % find the breakpoint locations in the B vector
for i=1:2 % for the two sections
B0(i)=interp1(M(ix(i):ix(i+1)),B(ix(i):ix(i+1)),0); % find linear interpolated crossing
end
>> B0 % See what answers are...
B0 =
-0.3493 0.3815
>>

Categories

Find more on Discrete Data Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!