Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
CAT Arguments

Subject: CAT Arguments

From: Will Rees

Date: 14 Sep, 2010 15:08:39

Message: 1 of 2

I am trying to graph the following data but I can't get it to work

>> Po=1000;
R=0.08;
T=30;
P=Po*exp(R*T);
T=[0:1:30];
[T', P'];
plot(T,P);
title('Compounded Interest');
xlabel('Time, Years');
ylabel('Money, Dollars');
grid on
??? Error using ==> horzcat
CAT arguments dimensions are not consistent.

where did i mess up?

Subject: CAT Arguments

From: Sean

Date: 14 Sep, 2010 15:30:31

Message: 2 of 2

"Will Rees" <willrees@yahoo.com> wrote in message <i6o35n$1kt$1@fred.mathworks.com>...
> I am trying to graph the following data but I can't get it to work
>
> >> Po=1000;
> R=0.08;
> T=30;
> P=Po*exp(R*T);
> T=[0:1:30];
> [T', P'];

The error occurs here because P is a 1x1 and T' is a 31x1. You defined T twice; look at the first place you define it. You then calculate P with this value and redefine T to be bigger.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us