Hi Everyone
Re; Help with MATLAB...basic stuff
Let me start with..."What the heck have I let myself in for???? "
I'm 43 years old
Haven't studied anything related to math in 10+ years.
Enrolled in University via distance education in Australia.
I live in a small town in Queensland's outback.
I have asked around town...only around 1000 people...no one knows anything regarding MATLAB.
I have watched the videos on the www.mathworks sites over and over....went through the textbook and studyguide over and over.
I am supposed to be able to do this after chapter 3...but I am really struggeling.
I have entered the formulas and it seems to execute, but I can't get it to plot.
I don't expect anyone to do my assignment, I have done work.
I can type the question out here and my few lines of code (function file and script file)
Regards
The assignment is due in 6 hours and I really don't want to fail.
MISTERMUSTARD :-(

well, it's nice to post a reply? post here, but I'm kind off missing some parts in your posts.

what is it that you need done?
what is it that you have done?
what is it that you're struggling with?
what textbook do you use, how are we supposed to …

Just for a quick look, you have mismatch call for function. The DNFUNCTION is returning 8 values at once, but you attempt to put them all in 2 variables when you call.

function [x1,y1,x2,y2,x3,y3,x4,y4]=DNFUNCTION(a,b,d,t);
...
[x1, y1]=DNFUNCTION(a,b,d,t);

Try to add variables to accept all return values.

PS: Matlab …

## All 8 Replies

well, it's nice to post a reply? post here, but I'm kind off missing some parts in your posts.

what is it that you need done?
what is it that you have done?
what is it that you're struggling with?
what textbook do you use, how are we supposed to know what you've seen?

if the assignment is due in six hours, well ... good luck, you might need it. :/

I'll try to upload the question as a pdf and type what I have written so far
I have to have 2 files a function file and a script file.
This is what i have so far

Function file:

function [x1,y1,x2,y2,x3,y3,x4,y4]=DNFUNCTION(a,b,d,t);
x1=sin((at)+d);
y1=sin(b
t);
x2=sin((at)+d);
y2=sin(b
t);
x3=sin((at)+d);
y3=sin(b
t);
x4=sin((at)+d);
y4=sin(b
t);
end

and a script file:

%QUESTION 2A
t=[0:0.1:2*pi];
a=1;
b=1;
d=0;
[x1, y1]=DNFUNCTION(a,b,d,t);
plot(x1,y1)

%QUESTION 2B
T2=[0,0,0,2,0,-1];
T3=[0,4,0,-3,0];
Z=[2,0];

%MULTIPLY Z BY T3
b=conv(Z,T3);
c=(b-T2);
%CO-EFFICIENTS ARE
d=c(2);
e=c(4);
f=c(6);

%QUESTION 2C
B=1;
a=1;
b=4;
d=3pi/8;
t=[0:0.001:2
pi];
y=Bsin(bt);

T4=8t.^4-8t.^2+1;

E=(min(y)-min(T4)).^2

I don't know what i did wrong and I can't seem to generate any plots.
please tell me where I am going wrong?
Regards
MisterMustard

I'll try to attach the pdf again

trying again...

Hi
The page doesn't seem to want to upload the pdf...any ideas anyone?

Just for a quick look, you have mismatch call for function. The DNFUNCTION is returning 8 values at once, but you attempt to put them all in 2 variables when you call.

function [x1,y1,x2,y2,x3,y3,x4,y4]=DNFUNCTION(a,b,d,t);
...
[x1, y1]=DNFUNCTION(a,b,d,t);

Try to add variables to accept all return values.

PS: Matlab is not cheap and not free (license). It is only available to those who are in the science field and in higher education. I think that's why not many people know about it. I did used it for a year or so to work with Computer Vision and another staticstic classes. I've not used it for many years now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.