필터 지우기
필터 지우기

How to make decreasing quadratic curve?

조회 수: 2 (최근 30일)
Kalasagarreddi Kottakota
Kalasagarreddi Kottakota 2022년 10월 20일
답변: Image Analyst 2022년 10월 20일
Hi, I am looking a decreaing quadratic of red colour in the image below. But when I script, I get the curve (in blue). Can someone help me to fix this?
clear all; close all; clc;
fs = 10200; % sampling frequency
dt = 1/fs;
T = 26; % total time
tVec = dt:dt:T; % time vector
rpm2 = 4500; f2 = rpm2/60;
rpm3 = 0; f3 = rpm3/60;
beta = (f3-f2)/T.^2; % slope rate;
finst = f2 + beta*tVec.^2.';
Speed = finst * 60;
figure()
plot(tVec, Speed)
grid on; box on;

채택된 답변

DGM
DGM 2022년 10월 20일
Are you after something like this?
fs = 10200; % sampling frequency
dt = 1/fs;
T = 26; % total time
rpm2 = 4500; f2 = rpm2/60;
rpm3 = 0; f3 = rpm3/60;
tVec = dt:dt:T; % time vector
beta = (f3-f2)/T.^2; % slope rate;
finst = f3 - beta*(T-tVec).^2.';
Speed = finst * 60;
plot(tVec, Speed)
grid on; box on;

추가 답변 (1개)

Image Analyst
Image Analyst 2022년 10월 20일
Well your formula just doesn't do that. But here's something closer. At least I have the colors of the lines changing.
all_rpm2 = linspace(4500, -1000, 10);
numCurves = numel(all_rpm2)
numCurves = 10
% Create red colormap
cmap = zeros(numCurves, 3);
cmap(:, 1) = linspace(0.2, 1, numCurves)';
fs = 10200; % sampling frequency
dt = 1/fs;
T = 26; % total time
tVec = dt:dt:T; % time vector
for k = 1 : length(all_rpm2)
rpm2 = all_rpm2(k)
f2 = rpm2/60;
rpm3 = 0;
f3 = rpm3/60;
beta = (f3-f2)/T.^2; % slope rate;
finst = f2 + beta * tVec.^2.';
Speed = finst * 60;
plot(tVec, Speed, 'Color', cmap(k, :), 'LineWidth', 3)
grid on;
box on;
hold on;
end
rpm2 = 4500
rpm2 = 3.8889e+03
rpm2 = 3.2778e+03
rpm2 = 2.6667e+03
rpm2 = 2.0556e+03
rpm2 = 1.4444e+03
rpm2 = 833.3333
rpm2 = 222.2222
rpm2 = -388.8889
rpm2 = -1000

카테고리

Help CenterFile Exchange에서 Pulsed Waveforms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by