Plots for second order control system in the same graph
Show older comments
I'm been trying to graph this equation without success.I keep getting an error message that says:Warning: Imaginary parts of complex X and/or Y arguments ignored.
Note: input is in radiant.
Here is my code:
% Exersice 11
x = input('Please enter vector x in degree: ');
z = [0.1 0.2 0.4 0.7 0.9];
y1 = 1-1/sqrt(1-z(1,1).^2).*exp(-z(1,1).*x).*sin(sqrt(1-z(1,1).^2)).*x+acos(x);
y2 = 1-1/sqrt(1-z(1,2).^2).*exp(-z(1,2).*x).*sin(sqrt(1-z(1,2).^2)).*x+acos(x);
y3 = 1-1/sqrt(1-z(1,3).^2).*exp(-z(1,3).*x).*sin(sqrt(1-z(1,3).^2)).*x+acos(x);
y4 = 1-1/sqrt(1-z(1,4).^2).*exp(-z(1,4).*x).*sin(sqrt(1-z(1,4).^2)).*x+acos(x);
y5 = 1-1/sqrt(1-z(1,5).^2).*exp(-z(1,5).*x).*sin(sqrt(1-z(1,5).^2)).*x+acos(x);
plot(x,y1,x,y2,x,y3,x,y4,x,y5, 'm'), xlabel('x in radiands'), ylabel('y(x)') ,title('1-1/{\surd}(1-\zeta^2)e^-^\zeta^xsin{\surd}(1-\zeta^2)x+cos^-^1(x)'), grid, legend('\zeta = 0.1','\zeta = 0.2','\zeta = 0.4','\zeta = 0.7','\zeta = 0.9')
Accepted Answer
More Answers (1)
Mischa Kim
on 26 Mar 2014
Edited: Mischa Kim
on 26 Mar 2014
Carlos, check out
function myDE()
prompt = {'xmin:','xmax:'};
name = 'Input x-range';
numlines = 1;
xlimits = inputdlg(prompt,name,numlines);
N = 100;
x = linspace(str2num(xlimits{1}),str2num(xlimits{2}),N);
z = [0.1 0.2 0.4 0.7 0.9];
hold all
for ii = 1:numel(z)
y = 1 - (1/sqrt(1-z(ii)^2))*exp(-z(ii)*x).*sin(sqrt(1-z(ii)^2)*x...
+ acos(z(ii)));
plot(x,y)
end
end
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!