if true % code
endt=linspace(-2,2,101);xa=zeros(1,size(t,2));xp=zeros(1,size(t,2));p=input('please input value for p:');for i=1:1:size(t,2) xa(i)=1-2*sin(pi*t(i))+cos(2*pi*t(i))+3*cos(3*pi*t(i));endfor i=1:1:size(t,2) for k=-p:1:p Xa=1-2*sin(pi*2*k)+cos(2*pi*2*k)+3*cos(3*pi*2*k); s=6*pi*(t(i)-2*k); xp(i)=xp(i)+Xa*u_sinc(s); endendfigure(2)plot(t,xp,'b');hold onplot(t,xa,'r');
MATLAB: I want this to run 3 times with values of p =5 10 and 20 and graph each of them in subplot instead of having p=input
MATLABsubplot
Related Question
- How to create a fuction p(t)
- Integral3 reached limit error
- Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.
- How can i give multiple input values in this function
- Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN
Best Answer