[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Need some help in octave. How do I get this to work? I'm

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 14
Thread images: 5

File: dwdd.png (13KB, 498x308px) Image search: [Google]
dwdd.png
13KB, 498x308px
Need some help in octave.
How do I get this to work?
I'm getting all kinds off errors I don't know what to do.
>>
you're trying yo use Baum.m before it is even defined. Just use an inline function at the top
>>
File: wewewe.png (11KB, 527x283px)
wewewe.png
11KB, 527x283px
Ok I got it to work.

Now how do I get it to work if A,B,D,E and F are 1x3 vectors?

So it plots 3 lines. One for the first, second and third values.
>>
you aren't programming properly man. you don't put the variables inside a function like that. That second script will run if you delete the first line and the last line of your code(no need for it to be a function that takes arbitrary variables)
>>
Here's how to do it with Baum as a function that can be used within the script.

Baum = @(T,A,B,D,E,F) (A+B)*(D/T/(sinh(D/T))).^2 ...
+ E*(F/T/(cosh(F/T))).^2;
T = 200:10:1500;
A= 0.7568*1e5;
B = 3.3924*1e5;
D = 1.496*1e3;
E = 2.247*1e5;
F = 675.9;

n = length(T);
X = zeros(n);
for i = 1:n
X(i) = Baum(T(i),A,B,D,E,F);
end
plot(T,X);
>>
File: hrtbedc.png (14KB, 537x299px) Image search: [Google]
hrtbedc.png
14KB, 537x299px
I know I'm retarded but it should be something like this right?
>>
for vectors, just type in your vectors for A,B ... so on and change X to be X = zeros(3,n).
Then in the loop specify
X(1,i) = Baum(T(i), A(1,i), B(1,i) ...)
X(2,i) = Baum(T(i), A(2,i), B(2,i) ...)
X(3,i) = Baum(T(i), A(3,i), B(3,i) ...)
>>
>>292912
if you want to do it like this then you need two loops and write X like this to get three columns:
X = zeros(length(T), length(A))
for i=1:length(T)
for j = 1:length(A)
X(i,j) = Baum(T(i), A(1,j), B(1,j) ...)
end
end
>>
If you have to submit this somewhere, I would use the code I wrote as it is more sensible. You're writing kind of a non-function the way you're doing it, doesn't make sense.
>>
>>292914
>>292918
where I had '...' I didn't mean it literally in the code, I meant the rest of the variables D,E,F in same way. cbf typing it
>>
File: ttttttt.png (25KB, 561x309px) Image search: [Google]
ttttttt.png
25KB, 561x309px
>>292918
Not sure if that's how you meant it.
Still getting an error.
I get it but what do I do about it?

>error: Baum: quotient: nonconformant arguments (op1 is 1x3, op2 is 1x131)
>error: called from
> Baum at line 9 column 4

>>292922
You mean >>292911 ?
How would it work if A,B,D,E,F were 1x3 vectors?

I get that it can't calculate X while there's 1x3 and 1x131 vectors but I have no idea how to solve this.
>>
File: qqqq.png (19KB, 782x364px)
qqqq.png
19KB, 782x364px
>>292929
Now I did it like this.
Getting a new error though:
>error: max_recursion_depth exceeded
>error: called from
> Baum at line 14 column 11

Every time I work past one error I get a new one.
>>
>>292934
>>293140

so you just need to get rid of the part that says 'function [X]'
and also the 'endfunction'
and this will run
>>
>>293141
function [X] = *
Thread posts: 14
Thread images: 5


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.