Error: This statement is incomplete.

6 views (last 30 days)
Putra
Putra on 7 Dec 2022
Edited: Rena Berman on 27 Dec 2022
Hello. This is my code and I keep getting the error "This statement is incomplete." several times throughout but can't find the mistake. code
%Interpolasi
disp('Tekan ENTER Untuk Memulai Program')
pause
disp(' ')
disp('=========== Peluruhan Radioaktif ==============')
disp('================================================')
N0=input('Masukkan jumlah zat mula-mula = ');
t=input('Masukkan selang waktu = ');
t_p=input('Masukkan paruh waktu zat = ');
disp(' ')
disp('Tekan ENTER Untuk Menampilkan grafik')
pause
Nt=N0*(0.5).^(t/t_p);
y1=[N0 N0/2 N0/4 N0/8 N0/16 N0/32 N0/64 N0/128 ...N0/256 N0/512 N0/1024 ];
x1==[0 t_p t_p*2 t_p*3 t_p*4 t_p*5 t_p*6 t_p*7 t_p*8 t_p*9 t_p*10];
x2==linspace(min(x1),max(x1));
y2==interp1(x1,y1,x2,'spline','extrap');
pause
%grafik prinsip radioaktivitas
subplot(221);
scatter(x1,y1,'r');
hold on
plot(x1,y1,'b');
grid on
title('Grafik peluruhan zat radioaktif (sebelum interpolasi)');
xlabel('Waktu');
ylabel('Jumlah zat');
%grafik interpolasi
subplot(222);
scatter(x1,y1,'r');
hold on
plot(x2,y2,'b');
grid on
title('Grafik peluruhan zat radioaktif (setelah interpolasi)');
xlabel('Waktu');
ylabel('Jumlah zat');
error
Line: 39
Column: 22
This statement is incomplete.
  2 Comments
Stephen23
Stephen23 on 7 Dec 2022
Edited: Stephen23 on 7 Dec 2022
Original question that was rudely deleted by Putra, retrieved from Bing Cache:
"Error: This statement is incomplete."
Hello. This is my code and I keep getting the error "This statement is incomplete." several times throughout but can't find the mistake.
%Interpolasi
disp('Tekan ENTER Untuk Memulai Program')
pause
disp(' ')
disp('=========== Peluruhan Radioaktif ==============')
disp('================================================')
N0=input('Masukkan jumlah zat mula-mula = ');
t=input('Masukkan selang waktu = ');
t_p=input('Masukkan paruh waktu zat = ');
disp(' ')
disp('Tekan ENTER Untuk Menampilkan grafik')
pause
Nt=N0*(0.5).^(t/t_p);
y1=[N0 N0/2 N0/4 N0/8 N0/16 N0/32 N0/64 N0/128 ...N0/256 N0/512 N0/1024 ];
x1==[0 t_p t_p*2 t_p*3 t_p*4 t_p*5 t_p*6 t_p*7 t_p*8 t_p*9 t_p*10];
x2==linspace(min(x1),max(x1));
y2==interp1(x1,y1,x2,'spline','extrap');
pause
%grafik prinsip radioaktivitas
subplot(221);
scatter(x1,y1,'r');
hold on
plot(x1,y1,'b');
grid on
title('Grafik peluruhan zat radioaktif (sebelum interpolasi)');
xlabel('Waktu');
ylabel('Jumlah zat');
%grafik interpolasi
subplot(222);
scatter(x1,y1,'r');
hold on
plot(x2,y2,'b');
grid on
title('Grafik peluruhan zat radioaktif (setelah interpolasi)');
xlabel('Waktu');
ylabel('Jumlah zat');
error
Line: 39 Column: 22
This statement is incomplete.
This statement is incomplete.
Rena Berman
Rena Berman on 27 Dec 2022
(Answers Dev) Restored edit

Sign in to comment.

Answers (1)

Stephen23
Stephen23 on 7 Dec 2022
Edited: Stephen23 on 7 Dec 2022
On this line:
y1=[N0 N0/2 N0/4 N0/8 N0/16 N0/32 N0/64 N0/128 ...N0/256 N0/512 N0/1024 ];
you use three dots to tell MATLAB that you will continue the code on the next line. But you don't.
Solution: get rid of the three dots. Even better (assuming that N0 is scalar):
y1 = N0 ./ pow2(0:10)
  1 Comment
Image Analyst
Image Analyst on 7 Dec 2022
?huh? I don't see that at all. Did @Putra destroy the original post?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!