4 views (last 30 days)

Only axes are appearing but plot is not showing. Please help me to detect the error i am making in the program. Apologies for a long code.

clear all; close all; clc;

test_points=3;

start_point=1000;

x_rec(1)=x(start_point);

x_real(1)=x(start_point);

c1=ksaix(1);

c2=ksaix(2);

c3=ksaix(3);

c4=ksaix(4);

c5=ksaix(5);

c6=ksaix(6);

c7=ksaix(7);

c8=ksaix(8);

c9=ksaix(9);

c10=ksaix(10);

c11=ksaix(11);

c12=ksaix(12);

c13=ksaix(13);

c14=ksaix(14);

c15=ksaix(15);

c16=ksaix(16);

c17=ksaix(17);

c18=ksaix(18);

c19=ksaix(19);

c20=ksaix(20);

c21=ksaix(21);

c22=ksaix(22);

c23=ksaix(23);

c24=ksaix(24);

c25=ksaix(25);

error=0;

DN=0;

for i=4:test_points

x_rec(i)=c1+c2*x_rec(i-1)+c3*x_rec(i-1)^2+c4*x_rec(i-1)^3+c5*x_rec(i-1)^4+c6*x_rec(i-1)^5+c7*x_rec(i-1)^6+c8*x_rec(i-1)^7+c9*x_rec(i-1)^8+c10*x_rec(i-1)^9+c11*x_rec(i-1)^10+c12*x_rec(i-1)^11+c13*x_rec(i-1)^12+c14*x_rec(i-1)^13+c15*x_rec(i-1)^14+c16*x_rec(i-1)^15+c17*x_rec(i-1)^16+c18*x_rec(i-1)^17+c19*x_rec(i-1)^18+c20*x_rec(i-1)^19+c21*x_rec(i-1)^20+c22*x_rec(i-1)^21+c23*x_rec(i-1)^22+c24*x_rec(i-1)^23+c25*x_rec(i-1)^24;

error=error+(x_rec(i)-x_real(i))^2;

DN=DN+x_real(i)^2;

end

Error_x(count)=sqrt(error)/sqrt(DN);

end

figure

hold on

plot (Data,Error_x,'s-r')

Image Analyst
on 17 Oct 2020

Look at the first few lines:

clear all; close all; clc;

test_points=3;

start_point=1000;

x_rec(1)=x(start_point);

Now you try to get x(start_point) but you never defined it. SO that throws an error. Or if you did (in another script), you blew it away with the clear all command.

Opportunities for recent engineering grads.

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

Start Hunting!
## 6 Comments

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/616428-why-is-my-plot-not-showing#comment_1064913

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/616428-why-is-my-plot-not-showing#comment_1064913

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/616428-why-is-my-plot-not-showing#comment_1064988

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/616428-why-is-my-plot-not-showing#comment_1064988

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/616428-why-is-my-plot-not-showing#comment_1065188

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/616428-why-is-my-plot-not-showing#comment_1065188

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/616428-why-is-my-plot-not-showing#comment_1065548

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/616428-why-is-my-plot-not-showing#comment_1065548

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/616428-why-is-my-plot-not-showing#comment_1066008

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/616428-why-is-my-plot-not-showing#comment_1066008

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/616428-why-is-my-plot-not-showing#comment_1066013

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/616428-why-is-my-plot-not-showing#comment_1066013

Sign in to comment.