Sorry, I was asked to take this down by my professor. He didn't want people copying my code next year.

댓글 수: 1

John D'Errico
John D'Errico 2020년 3월 2일
Then don't post your homework assignment in the future.

댓글을 달려면 로그인하십시오.

 채택된 답변

Benjamin Großmann
Benjamin Großmann 2020년 2월 26일
편집: Benjamin Großmann 2020년 2월 26일

0 개 추천

I assume that In your code line 28 it should be t(j) and t(j-1) instead of t(n) and t(n-1) respectively. Then your code at least is running.
For now, lets stick to that line. What is your intention here? You are extending an array by incrementing its last value. Try using the colon operator or the linspace command for array creation. For evenly spaced arrays they are way more powerful and comprehensible.

댓글 수: 4

Danisaurus
Danisaurus 2020년 2월 26일
Yes thanks, those n's are supposed to be j's .
To be honest I don't really know what to do with that array. My professor mentioned it during the lecture so I figured I had to use it somewhere, but I don't know where or how.
t is also not used in your code. Without further knowledge of the assignment, it is a bad guess, but i think it is the time vector, maybe for plotting, e.g. plot(t, u_be(50,:)). Can you provide more information about the assignment?
Back to your initial Problem "Everytime I only get one line. I have no idea where I'm going wrong." Please have a look at your plot when you change your column index for plotting, e.g.:
plot(x, u_be(:,10),'linewidth',1);
plot(x, u_be(:,1000),'linewidth',1);
plot(x, u_be(:,10000),'linewidth',1);
Danisaurus
Danisaurus 2020년 2월 26일
Thank you so much! The plotting was the problem!
Benjamin Großmann
Benjamin Großmann 2020년 2월 26일
You are welcome and thank you for accepting the answer!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

제품

질문:

2020년 2월 26일

댓글:

2020년 3월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by