i have just editted my original post to make more sense in terms of the code, i am still unable to produce the graph i want within my code
How to develop a ramp up of values into a matrix
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Adil Saeed
el 24 de Ag. de 2022
Comentada: Adil Saeed
el 25 de Ag. de 2022
I am trying to develop a ramp up. so i have an empty matrix named SL, and im trying to assign values to it. I want the first PnC(1), (50 values in this case) of the SL matrix to be a ramp up from 200 to 210. A ramp up being a literal ramp, so the values increase based on the gradient between 200 and 210 and the rest of the SL matrix, the values being 210.
My code and model is rather long so ive tried to include the relevant code. What i have at the moment is a steady step up (first 50 values being 200 and then >50 being 210).
%Number of Positions and Impacts
In = [50, 60, 75, 375, 420, 360];
Pn = sum(In);
PnC = cumsum(In);
%Time
T = 5400;
INT = 900;
TINT = 0:INT:T;
n = numel(TINT);
TVpieces = cell(1, n-1);
for iter = 1:n-1
Inc = INT/In(iter);
TVpieces{iter} = TINT(iter):Inc:(TINT(iter+1)-Inc);
end
TV = [TVpieces{:}];
SL = zeros(Pn,1);
for i = 1:Pn
%Source Level
if i<=PnC(1)
SL(i) = 200; %(1/90)*TVpieces{1,1} +
else
SL(i) = 210; %+ randi([-1 1]);
end
end
set(plot(TV,SL,'.'),'markersize',3)
as you can see noted out i have tried to develop the ramp up but having no success.
Respuesta aceptada
Matt J
el 24 de Ag. de 2022
n=100; PnC=50;
SL=repelem(210,1,n);
SL(1:PnC(1))=linspace(200,210,PnC(1));
plot(SL); axis padded
4 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

