How to find the angular frequency and theta

clear all
close all
%define the variable
t = 2; %time(in s)
omega = linspace (-2*pi/3,pi) %angular frequency
pm = 101325; %mean pressure (in Pa)
pA = 10; %av. fluctuation amplitude (in Pa)
a = 348; %speed of sound
dA = 1.20; %density air
theta = linspace(0,pi/2)
%calculate the pressure
p = pm + pA*(cos(omega*t));
%calculate the displacement
zeta = (pA/dA*a)*cos((omega*t)-(pi/2-theta));
The problem is I need to find the omega(angular frequency) and theta but Im using the 'linspace' function

 Accepted Answer

I see nothing wrong with using linspace() to define variables, but usually one supplies the number of elements, like 1000 or whatever
omega = linspace (-2*pi/3, pi, 1000)
theta = linspace(0, pi/2, 1000)

4 Comments

actually, after I run the coding, everything was just fine, like I will get what I need to find. Yet, the problem occurs when my supervisor ask me to find the omega and theta value. for example, if I used the very first value of p or zeta value, still i can get the answer but it will vary as for the next vlaue of the omega and theta.
Yes, zeta and p will vary, as they should. And you don't really "find" omega and theta - you "define" them. Since you defined them, you don't really need to "find" them since they are already known (defined).
originally, i need to plot something like this (refer graph) with these two formula
  1. p = p_m + p_A cos (omega*t)
  2. zeta = (pA/dA*a)*cos((omega*t)-(pi/2-theta));
for now I only have the value the rest of the variables except the omega/angular frequency plus the theta is given in range value: 0<θ< pi/2
So you need to define a variable called omegat with linspace
omegat = linspace(-2*pi, p*pi, 1000); % or whatever you want.
p = p_m + p_A cos (omegat)
plot(omegat, p, 'b-', 'LineWidth', 2);
grid on;

Sign in to comment.

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!