why i am not getting desired result ??
1 view (last 30 days)
Show older comments
i need intensity ratio of trapezoidal wave form as given in attached file but something being wrong, please help my code is here:
%%FIRST TRAPEZOIDAL WAVE FORM
clc; clear all;
imx=8;
imn=2;
T = 20;
s1= @(x) (imx+imn).*((0<=x & x<=T/6)|(x>=5*T/6 & x<=T))...
+(imx+imn*(2-6*x/T)).*(T/6<=x & x<=T/3)...
+(imx).*(T/3<=x & x<=2*T/3)...
+(imx+imn*(6*x/T-4)).*(2*T/3<=x & x<=5*T/6);
x = linspace(0,20,500);
I1 = s1(x);
figure(1), plot(x,I1)
ylim([.9*imx 1.1*(imx+imn)])
%%SECOND TRAPEZOIDAL WAVE FORM
imx=8;
imn=2;
T = 20;
s2= @(x) (imx+imn*(6*x/T)).*(0<=x & x<=T/6)...
+(imx+imn).*(T/6<=x & x<=T/2)...
+(imx+imn*(4-6*x/T)).*(T/2<=x & x<=2*T/3)...
+(imx).*(2*T/3<=x & x<=T);
x = linspace(0,20,500);
I2 = s2(x);
figure(2),plot(x,I2)
ylim([.9*imx 1.1*(imx+imn)])
THIRD TRAPEZOIDAL WAVE FORM
imx=8;
imn=2;
T = 20;
s3= @(x) (imx).*(0<=x & x<=T/3)...
+(imx+imn*(6*x/T-2)).*(T/3<=x & x<=T/2)...
+(imx+imn).*(T/2<=x & x<=5*T/6)...
+(imx+imn*(6-6*x/T)).*(5*T/6<=x & x<=T);
x = linspace(0,20,500);
I3 = s3(x);
figure(3)
plot(x,I3)
ylim([.9*imx 1.1*(imx+imn)])
%%intensity ratio (wrapped map)
r0=(I2-I1)./(I3-I1);
figure(4)
x = linspace(0,20,500);
plot(x,r0)
ylim([.9*imx 1.1*(imx+imn)])
%%intensity ratio (unwrapped map)
N=6;
r1=2*round((N-1)./2)+((-1)^N+1).*r0;
figure(5)
x = linspace(0,20,500);
plot(x,r1)
ylim([.9*imx 1.1*(imx+imn)])
Accepted Answer
Image Analyst
on 16 Aug 2017
You need to use repmat() to turn your 1-D signal into a 2-D image.
0 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!