Greetings all,
Please correct me if I am wrong on any of this, but I am trying to plot a damped/attenuating sine wave of the form y(x,t)=Ae^-alpha(x) * sin(wt-Bx + phi).
Granted the sin is not in the exponential, I've been trying to code this up knowing that travelling waves have spatial as well as temporal dimensions.
The code I have after user input is:
x=0:.001:1;
Beta = 2*pi/lambda;
y1=zeros(100,100);
for t=0:.001:1
y1(t,:)=A*sin(Beta*x-w*t + phi).exp(-alpha*x)
end
%A, alpha, w, and phi are user input as well
So I'm getting a "Subscript indices must be either real positive integers or logicals." Where am I going wrong?
Also, I am trying to plot this damped wave - do I need to use plot3? If so, why?
Thanks!
-J
1 Comment
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/179504-plotting-damped-sine-travelling-wave-equation-in-matlab#comment_834083
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/179504-plotting-damped-sine-travelling-wave-equation-in-matlab#comment_834083
Sign in to comment.