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. 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 Kommentare

Stephen23
Stephen23 am 7 Dez. 2022
Bearbeitet: Stephen23 am 7 Dez. 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 am 27 Dez. 2022
(Answers Dev) Restored edit

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Stephen23
Stephen23 am 7 Dez. 2022
Bearbeitet: Stephen23 am 7 Dez. 2022

0 Stimmen

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 Kommentar

Image Analyst
Image Analyst am 7 Dez. 2022
?huh? I don't see that at all. Did @Putra destroy the original post?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Language Fundamentals finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 7 Dez. 2022

Bearbeitet:

am 27 Dez. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by