Computer Science Homework Solutions
Problem
#7744

Matlab plotting cosh and sinh on a single plot using a script file

I have no idea what I'm doing. I got help writing a Matlab program that plots the cosh(3x-(pi/2)) and sinh(5x+(pi/8)) on a single plot from x=-5 to 25 using a script file. But could you please explain to me what each line of this script file represents/does and how I actually get the graph to come up in Matlab? I especially don't understand what the i's, n's, and colons are for. Please see attachment.

Thanks.

Attached file(s):
Attachments
plot stuff.doc  View File

Attachment Content Summary (Note: view attachment at the above link before purchasing. Actual attachment content may vary slightly from that shown below.)

plot stuff.doc
%plot stuff

%i=1

x(1)=-5

n=300

for i=1:n+1

y(1,i)=cosh(3*x(i)-pi/2);

y(2,i)=sinh(5*x(i)+pi/8);

x(i+1)=x(i)+30/n;

%i=i+1;

end

plot(x(1:n+1),y(1,:),'kd',x(1:n+1),y(2,:),'rh')
Solution
What is this?
By OTA - Overall OTA Rating
Amrit Lal Ahuja, PhD (IP) - 4.9/5
Purchase Cost Now
$2.19 CAD (was ~$3.99)
Included in Download
  • Plain text response
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
Browse