Question

Using matlab, create a 3-D plot of the wave equation y(x,t)= cos(omega*t-beta*x) .Plot for a time...

Using matlab, create a 3-D plot of the wave equation y(x,t)= cos(omega*t-beta*x) .Plot for a time range from t=0 to t=2T and a space range of x=0 to x=2lambda

0 0
Add a comment Improve this question Transcribed image text
Answer #1
f=100;
w=2*pi*f;
a=1;
x=linspace(-5,5,50);
t=linspace(0,2,50);


for k = 0.05:0.01:2         % Change values of e.g. k
    n = a.*cos(k.*x-w.*t);  % Re-calculate n
    pause(0.02)             % pause to control animation speed
    s = surf(x,t,repmat(n,[length(t),1])); % Use repmat to make Z 2D
    title(['k = ',num2str(k)])

    % Just some nice settings for surf plot
    shading interp
    lighting phong
    camlight left; camlight right; camlight left; camlight right;
    colormap copper
    alpha(.8)
end

In the above code you can easily change the values of x and t according to the values set by you for OMEGA and lambda and the curve will be plot accordingly.

Alternatively, I have a simpler code:'

k=0.05;
f=100;
w=2*pi*f;
a=1;
[x,t]=meshgrid(-5:1:5,0:2:20);
n=a.*cos(k.*x-w.*t);
surf(x,t,n);

Here's the plot which comes up :-

Add a comment
Know the answer?
Add Answer to:
Using matlab, create a 3-D plot of the wave equation y(x,t)= cos(omega*t-beta*x) .Plot for a time...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT