How can i find the co-ordinates of a point where the slop is -1 in below graph ?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
John D'Errico
2023-2-5
编辑:John D'Errico
2023-2-5
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?
采纳的回答
Star Strider
2023-2-5
编辑:Star Strider
2023-2-5
Try this —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1285050/cmos.txt', 'VariableNamingRule','preserve')
Vin = T1.('V(vin)');
Vout = T1.('V(vout)');
dVoutdVin = gradient(Vout) ./ gradient(Vin);
[minslope,idx] = min(dVoutdVin)
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)
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.
.
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!