Dear.

in my code below I am trying to plot an output.

This output is related to a vector S so , the output would equal 1 if the value of time t equals one (1) of the value of the vector S else the output = 0

how to integrate this if statement wit the fact that S is a vector

I tried a lot

Instead of the (3) I need to make an index

My code:

clear all

omega=1000 %rotation frequency (rpm)

omega_rad=(omega*2*pi)/60 %rotation frequency (rad/s)

TRot=(360*(pi/180))/omega_rad %Time of one rotation

Holes=15 %Number of holes in Cylinder

Pressure_In1=0 %Pressure Amplitude in Bar

Pressure_In2=1 %Pressure Amplitude in Bar

alpha=360/Holes %angles between holes (degree)

beta=11.20 %angles swept by 1 hole (degree)

alpha_rad=alpha*(pi/180) %angles between holes (rad)

beta_rad=beta*(pi/180) %angles swept by 1 hole (rad)

k=TRot/100 %timestep

h=1

f=1

for N=1:1:Holes

s= TRot*(N*alpha)/360

S(f)=s

f=f+1

end

for time=0:k:TRot

if (time>(S(3)-0.002))&&(time

More Mohammed Lamine Mekhalfia's questions See All
Similar questions and discussions