Ask your own question, for FREE!
Mathematics 7 Online
OpenStudy (raffle_snaffle):

matlab

OpenStudy (raffle_snaffle):

OpenStudy (raffle_snaffle):

@jim_thompson5910

OpenStudy (raffle_snaffle):

snow_depth1 = Columns 1 through 21 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 Columns 22 through 42 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 Columns 43 through 61 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 snow_depth2 = Columns 1 through 21 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 Columns 22 through 42 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 Columns 43 through 59 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 winter13_14_sd = Columns 1 through 21 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 Columns 22 through 42 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 Columns 43 through 63 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 Columns 64 through 84 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 Columns 85 through 105 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 Columns 106 through 120 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424

jimthompson5910 (jim_thompson5910):

can you attach your m file for me? I want to try it out on my end

OpenStudy (raffle_snaffle):

jimthompson5910 (jim_thompson5910):

thanks

jimthompson5910 (jim_thompson5910):

ok so I forgot that the find function spits out the indices

jimthompson5910 (jim_thompson5910):

let me fix

jimthompson5910 (jim_thompson5910):

% get snow depth snow_depth = gcdata2(:,5); % find the snow depth data in nov 2013 and dec 2013 snow_depth_indices1 = find(year == 2013 & (month == 11 | month == 12)); snow_depth1 = snow_depth(snow_depth_indices1); % find the snow depth data in jan and feb 2014 snow_depth_indices2= find(year == 2014 & (month == 1 | month == 2)); snow_depth2 = snow_depth(snow_depth_indices2); % combine the two snow depths winter13_14_sd = [snow_depth1' snow_depth2'];

OpenStudy (raffle_snaffle):

now I need to use plotyy right?

jimthompson5910 (jim_thompson5910):

you do the same for the snowfall data, then you use plotyy

OpenStudy (raffle_snaffle):

working and thinking

jimthompson5910 (jim_thompson5910):

change `winter13_14_sd` to `winter13_14_sf`

OpenStudy (raffle_snaffle):

% get snowfall depth snow_fall = gcdata(:,6); % find the snowfall data snow_fall_indices1 = find(year == 2013 & (month == 11 | month == 2)); snow_fall_1 = snow_fall(snow_fall_indices1); % find the snowfall data snow_fall_indices2= find(year == 2014 & (month == 1 | month == 2)); snow_fall_2 = snow_fall(snow_fall_indices2); % combine the two snowfalls winter13_14_sf = [snow_fall_1' snow_fall_2'];

jimthompson5910 (jim_thompson5910):

better

jimthompson5910 (jim_thompson5910):

hmm strange, the winter13_14_sf variable has 3 less items than winter13_14_sd

jimthompson5910 (jim_thompson5910):

you used the wrong data matrix to get the snowfall you should use gcdata2

OpenStudy (raffle_snaffle):

wow... I always do that... lol

jimthompson5910 (jim_thompson5910):

they all look the same so I don't blame you

jimthompson5910 (jim_thompson5910):

for some reason, it's kicking out 0 values

jimthompson5910 (jim_thompson5910):

hmm maybe not, but I'm still coming up with 117 vs 120

jimthompson5910 (jim_thompson5910):

winter13_14_sf should have 120 values in it, but for some reason, it only has 117

OpenStudy (raffle_snaffle):

hmmmm

jimthompson5910 (jim_thompson5910):

oh I see what went wrong you wrote `snow_fall_indices1 = find(year == 2013 & (month == 11 | month == 2));` when it should be `snow_fall_indices1 = find(year == 2013 & (month == 11 | month == 12));`

jimthompson5910 (jim_thompson5910):

so you were pulling feb and nov 2013 data

OpenStudy (raffle_snaffle):

okay, so from here on out I can use plotyy ?

jimthompson5910 (jim_thompson5910):

yes

jimthompson5910 (jim_thompson5910):

you'll have [1:1:120] as the x vector to represent day 1 through 120 (nov 1st through feb 28th) the y values will differ for the 2 data sets see the figure at the top of page 4

OpenStudy (raffle_snaffle):

thinking

OpenStudy (raffle_snaffle):

so my y values are winter13_14_sf and winter12_14_sd ?

jimthompson5910 (jim_thompson5910):

correct

OpenStudy (raffle_snaffle):

plotyy([1:1:120], winter13_14_sd, [1:1:120], winter13_14_sf);

jimthompson5910 (jim_thompson5910):

yeah that should work

OpenStudy (raffle_snaffle):

so i suppressed the previous plots. When I run the code it displays four subplots, the 4th one displaying two graphs in one box.

jimthompson5910 (jim_thompson5910):

that's not supposed to happen hmm

jimthompson5910 (jim_thompson5910):

you need to create an entire new figure for the new plot

OpenStudy (raffle_snaffle):

plotyy([1:1:120], winter13_14_sd, [1:1:120], winter13_14_sf); so it looks like it works when I suppress the previous subplots

OpenStudy (raffle_snaffle):

let me attach an image

OpenStudy (raffle_snaffle):

jimthompson5910 (jim_thompson5910):

I'm not sure how to make a new figure, so I guess the best way to do it is to break it up into different cells. Cell 1 has figure 1, cell 2 with figure 2, etc etc

OpenStudy (raffle_snaffle):

okay

jimthompson5910 (jim_thompson5910):

but the graph you posted looks good

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!