How can i find the co-ordinates of a point where the slop is -1 in below graph ?
1 view (last 30 days)
Show older comments
Dhanvin Prajapati
on 5 Feb 2023
Edited: Dhanvin Prajapati
on 5 Feb 2023
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
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?
Accepted Answer
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')
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 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!