How can i find the co-ordinates of a point where the slop is -1 in below graph ?

1 view (last 30 days)
Here is a set of all the points known for the graph. Now how how can i find at which point(s) the slope of the curve is (-1) ?
  1 Comment
John D'Errico
John D'Errico on 5 Feb 2023
Edited: John D'Errico on 5 Feb 2023
Huh? A line with a slope of 90 degrees is not a line with a slope of -1. 90 degrees would imply what we usually call an infinite slope, but really, a slope larger than any finite number.
Anyway, there are THREE columns of numbers in that file, though the first column just appears to be a row number. But it was still labeled as vin. So what slope would you be hoping to compute?

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 5 Feb 2023
Edited: Star Strider on 5 Feb 2023
Try this —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1285050/cmos.txt', 'VariableNamingRule','preserve')
T1 = 181×3 table
vin V(vin) V(vout) ____ ______ _______ 0 0 1.8 0.01 0.01 1.8 0.02 0.02 1.8 0.03 0.03 1.8 0.04 0.04 1.8 0.05 0.05 1.8 0.06 0.06 1.8 0.07 0.07 1.8 0.08 0.08 1.8 0.09 0.09 1.8 0.1 0.1 1.8 0.11 0.11 1.8 0.12 0.12 1.8 0.13 0.13 1.8 0.14 0.14 1.8 0.15 0.15 1.8
Vin = T1.('V(vin)');
Vout = T1.('V(vout)');
dVoutdVin = gradient(Vout) ./ gradient(Vin);
[minslope,idx] = min(dVoutdVin)
minslope = -26.7229
idx = 79
idxv = find(diff(sign(dVoutdVin + 1)));
% idxv = [1 idx numel(Vin)];
for k = 1:numel(idxv)
idxrng = idxv(k)-1 : idxv(k)+1;
xv(k,:) = interp1(dVoutdVin(idxrng), Vin(idxrng), -1);
yv(k,:) = interp1(Vin(idxrng), Vout(idxrng), xv(k));
end
Slope_Negative_1_Coordinates = table(xv, yv)
Slope_Negative_1_Coordinates = 2×2 table
xv yv _______ _______ 0.60843 1.7097 0.86692 0.11947
figure
yyaxis left
plot(Vin, Vout, 'DisplayName','Data')
hold on
plot(xv, yv, 'rs', 'DisplayName','Slope = -1')
hold off
xlabel('$V_{in}$', 'Interpreter','latex')
ylabel('$V_{0ut}$', 'Interpreter','latex')
yyaxis right
plot(Vin, dVoutdVin, 'DisplayName','Derivative')
ylabel('$\frac{dVout}{dVin}$', 'Interpreter','latex')
grid
legend('Location','best')
EDIT — (5 Feb 2023 at 14:33)
Added ‘Slope_Negative_1_Coordinates’ table.
.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!