How to wrote code for Ramp Filter and show the firgure?
Mostra commenti meno recenti
Dear All,
Please help me how to plot the Ramp filter as picture attached. 

Risposta accettata
Più risposte (1)
numPoints = 101; % Whatever
bothRamps = zeros(1, numPoints); % Preallocate
% Make descending ramp with linspace().
leftRamp = linspace(126, 0, 51);
% Make ascending ramp with linspace().
rightRamp = linspace(0, 126, 51);
% Put them each into our filter vector.
bothRamps(1 : 51) = leftRamp;
bothRamps(51 : 101) = rightRamp;
% Create x axis.
x = linspace(-1, 1, numPoints);
% Plot the filter vector.
plot(x, bothRamps, 'b-', 'LineWidth', 2);
grid on;
xlabel('x');
ylabel('Filter Value');
% Put text label in the middle like the example.
text(0, 82, 'Ramp Filter', 'FontSize', 30, 'HorizontalAlignment', 'Center', 'VerticalAlignment', 'Bottom')
2 Commenti
mohd akmal masud
il 19 Mag 2024
Image Analyst
il 19 Mag 2024
You're welcome. Just be aware that my answer gives the x and y range the same as in the picture you wanted to reproduce, unlike the answer that you accepted.
Categorie
Scopri di più su Image Preview and Device Configuration in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

