How to erase contour beyond a line or multiple lines?

3 views (last 30 days)
Omidreza Ghafarinejad
Omidreza Ghafarinejad on 30 Jun 2015
Hi. I have contour of a function. I want to plot this contour over a triangle domain. I have the equations of the triangle boundary. So I think I must plot contour at first and then erase contour beyond the boundary lines. But I don't know how to do it. This is my code:
clc
clear all
T=100;
a=0.3;
syms y z real
tauxy=5.1966*T*z*(2*sqrt(3)*y+a)/a^5;
tauxz=5.1966*T*(-sqrt(3)*y^2+sqrt(3)*z^2+a*y)/a^5;
tau=sqrt(tauxy^2+tauxz^2);
z1=(sqrt(3)*y-a)/3;
z2=-z1;
figure(1)
ezcontour(tau,[-a/(2*sqrt(3)),a/sqrt(3),-0.16,0.16]);
hold on
ezplot(z1,[-a/(2*sqrt(3)) a/sqrt(3)]);
ezplot(z2,[-a/(2*sqrt(3)) a/sqrt(3)]);
axis([-a/(2*sqrt(3)),a/sqrt(3),-0.16,0.16]);
can anyone help me to do this job? if you can show me a better way to plot the contour restricted between these lines then I will be thankful. Also I want to know how to plot more contour lines in the triangle domain since most of the lines are out of the boundaries.

Answers (0)

Community Treasure Hunt

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

Start Hunting!